Closed
Bug 112008
Opened 23 years ago
Closed 23 years ago
implement modification count in Composer code (not nsIDiskDocument)
Categories
(SeaMonkey :: Composer, defect)
SeaMonkey
Composer
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.7
People
(Reporter: Brade, Assigned: Brade)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
akkzilla
:
review+
|
Details | Diff | Splinter Review |
implement dirty flag in Composer code (not nsIDiskDocument).
Comment 1•23 years ago
|
||
Note that this needs to be more than a dirty flag; it has to be a counter, so
that Undo can make the document non-dirty.
Assignee | ||
Comment 2•23 years ago
|
||
sorry; in my haste to file the bug, I mistyped: should be modCount (not dirtyFlag)
Status: NEW → ASSIGNED
Summary: implement dirty flag in Composer code (not nsIDiskDocument) → implement modification count in Composer code (not nsIDiskDocument)
Assignee | ||
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.7
Assignee | ||
Comment 3•23 years ago
|
||
This patch includes a little more than it needs to for this particular bug.
It also includes some #include cleanup (to be tested on other platforms
tomorrow) and the use of nsIWebBrowserPersist for saving. Sorry for the
compound fix!
Feedback please!
Comment 4•23 years ago
|
||
Comments:
+NS_IMETHODIMP nsEditor::IncrementModificationCount(PRInt32 inNumMods)
{
...
+ mModCount += inNumMods;
NotifyDocumentListeners(eDocumentStateChanged);
I think we only really want to send out a 'eDocumentStateChanged' when the
document changes state from clean to dirty, or vice versa (i.e. the mod count
changes from 0 to something, or something to 0).
+NS_IMETHODIMP nsEditor::ResetModificationCount()
{
...
+ mModCount = 0;
NotifyDocumentListeners(eDocumentStateChanged);
Ditto here. Only call NotifyDocumentListeners() if the mod count was not 0
before.
(Ignoring ComposerCommands.js changes).
I assume that there are diffs to nsIDiskDocument/nsDocument that remove the mod
count APIs there?
Assignee | ||
Comment 5•23 years ago
|
||
This updated patch has been built on Linux and Mac. It fixes the modCount
notification to happen less often (per sfraser above). I am still building on
Windows. When that finishes, I'll remove the commented out #includes.
Akkana--please r=
Simon--please sr=
Attachment #59403 -
Attachment is obsolete: true
Assignee | ||
Comment 6•23 years ago
|
||
cc akkana for her r=
also note: this patch is waiting for Adam's patch
Depends on: 110135
Comment 7•23 years ago
|
||
+ PRBool doNotify = (mModCount == 0) && (inNumMods > 0);
The inNumMods can actually be negative (for undo), so the code should read:
PRBool oldModCount = mModCount;
mModCount += inNumMods;
if ((oldModCount == 0 && mModCount != 0) || (oldModCount != 0 && mModCount ==
0))
NotifyDocumentListeners(eDocumentStateChanged);
There's probably a cleaner way, but that's the gist.
Comment 8•23 years ago
|
||
Comment on attachment 59583 [details] [diff] [review]
updated patch to address sfraser's comments
Looks good to me (modulo Simon's comments). Might be better to remove the
commented-out headers in nsEditor.cpp. Kathy says she's already removed the
gEditorOutputProgressListener dump()s.
The changes in nsEditorUtils.cpp and nsTextEditRules.cpp point out that
nsEditor.h is included in those classes' .h files, and shouldn't be (there's no
reason for it, and it slows down the build) -- that's not related to this
change but we should fix it at some point.
Attachment #59583 -
Flags: review+
Comment 9•23 years ago
|
||
sr=sfraser on all changes, given my and akkana's comments.
Assignee | ||
Comment 10•23 years ago
|
||
fixes checked in
Sujay--to verify this, you can just ensure that undo/redo work properly.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 11•23 years ago
|
||
brade, please verify....thanks..
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•