Closed
Bug 171243
Opened 22 years ago
Closed 22 years ago
redo doesn't work if more than one letter is to be reinserted
Categories
(Core :: DOM: Editor, defect, P1)
Core
DOM: Editor
Tracking
()
VERIFIED
FIXED
M1
People
(Reporter: Brade, Assigned: mozeditor)
References
Details
(Keywords: dataloss, regression, Whiteboard: EDITORBASE; fixinhand; need r=,sr=)
Attachments
(1 file)
8.59 KB,
patch
|
Brade
:
review+
kinmoz
:
superreview+
|
Details | Diff | Splinter Review |
Redo doesn't work in text widgets or in Composer: 1) type: abc 2) choose: edit>undo 3) choose: edit>redo Expectation: see: abc Actual Result: see: a
Reporter | ||
Updated•22 years ago
|
Whiteboard: EDITORBASE
Looks like during the redo, just after we put the textnode back into the tree with "a" in it, a call to nsSelectionState::RestoreSelection() is failing because it tries to create a range that places the caret at range(textnode, 2), and there is only one character currently in the text node.
Severity: normal → critical
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.2beta
This broke when the fix for bug 149320 went in. It's not so much the fix for bug 149320, but the fact that we have a placeholder transaction with children that look like this: 1. delete txn (the br node) 2. insert element (text node with "a") 3. placeholder (empty one created for the txn that follows) 4. insert text ("b") 5. placeholder (empty one created for the txn that follows) 6. insert text ("c") The empty placeholders are being appended into the outer one, and as a result when we redo them, the placeholder in #3 tries to restore the selection as if the insert text txn for "b" already happened.
Assignee | ||
Comment 4•22 years ago
|
||
I pulling patch apart from the others I worked on, I found other redo problems. Investigating those I discovered that they were caused by recent changes I made to nsEditor::InsertContainerAbove() and nsEditorReplaceContainer() a while back. So I had to also undo those changes, and since those changes had been a fix for another bug (voidArray assertions caused by comparing two ranges that were not in same document) I had to find another solution to that bug as well. That other solution is in nsHTMLEditRules.cpp. where I sanity check incoming ranges to UpdateDocChangedRange(). Meanwhile the original part of this patch carries on: I now do not place Placeholder txns as children inside other Placeholders. Since the editor needs a concept of the current placeholder txn, I had to make changes there for it to peek at the Undo stack. I'm confident none of this makes sense to anyone except maybe Kin. :-P
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Whiteboard: EDITORBASE → EDITORBASE; fixinhand; need r=,sr=
Target Milestone: mozilla1.2beta → M1
Reporter | ||
Comment 5•22 years ago
|
||
Comment on attachment 101519 [details] [diff] [review] patch to libeditor r=brade can we delete these lines in htmleditrules? +// we got startNode above already +// res = aRange->GetStartContainer(getter_AddRefs(startNode)); +// if (NS_FAILED(res)) return res;
Attachment #101519 -
Flags: review+
Comment on attachment 101519 [details] [diff] [review] patch to libeditor ==== Can we remove some of the code you commented out? - AppendChild(editTxn); + // AppendChild(editTxn); ... - nsCOMPtr<nsIDOMNode> startNode; PRInt32 startOffset; - res = aRange->GetStartContainer(getter_AddRefs(startNode)); - if (NS_FAILED(res)) return res; +// we got startNode above already +// res = aRange->GetStartContainer(getter_AddRefs(startNode)); +// if (NS_FAILED(res)) return res; ==== In |nsEditor::Do()| what's the purpose of |txn|? Why can't we just call |Do(theTxn);|? // finally we QI to an nsITransaction since that's what Do() expects nsCOMPtr<nsITransaction> theTxn = do_QueryInterface(plcTxn); nsITransaction* txn = theTxn; Do(txn); // we will recurse, but will not hit this case in the nested call ==== Is there any serious perf impact of calling this in |UpdateDocChangeRange()|? For example during a paste or some other operation over lots of nodes? + if (!mHTMLEditor->IsDescendantOfBody(startNode)) sr=kin@netscape.com if there isn't any significant perf degradation, and the points above are addressed.
Attachment #101519 -
Flags: superreview+
Assignee | ||
Comment 7•22 years ago
|
||
i addressed comments in checked in version. But I did leave one of the commented out code lines becasue I need it - else i'll forget later why i'm not merging placeholders in the most obvious way. fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
This caused a memory leak: bug 174123 (and no, that isn't just a typo of this bug number with some of digits mixed up).
You need to log in
before you can comment on or make changes to this bug.
Description
•