Closed Bug 12675 Opened 25 years ago Closed 25 years ago

[DOGFOOD] undoing typing is broken

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: akkzilla, Assigned: mozeditor)

References

Details

(Whiteboard: [PDT]+)

Joe writes: undoing typing is broken, in that typed characters are not properly merging into one undo. This was true both before and after the insert text refactoring. I may want some advice from Steve or Kin on this - as there is code there to do this that I have somehow broken, long ago. Needed for dogfood.
Blocks: 11864, 12658
Adding dependencies: it's a dogfood bug, and undo of insert html can't be written until inserting of nodes and text are fixed.
The problem here is that WillInsertText() is opening a transaction batch every time, even when it is executing a single transactions. The transaction manager does not support batch merging, only transaction merging. I suggest modifying WillInsertText() to only open a batch when it is going to execute more than one transaction.
Here's a log file that illustrates what happens when I type 'abc' in a blank document and then undo it 3 times. As stated above, if we removed the begin/end batches around the transactions that inserted 'b' and 'c', those 2 transactions would be merged into one. selRanges = [ [ [[0, 1, 0, 0], 0], [[0, 1, 0, 0], 0] ] ]; EditorSetSelectionFromOffsets(selRanges); window.editorShell.InsertText("a"); // WillBeginBatch: 0 // DidBeginBatch: 0 (0) // WillDo: <NULL> // DidDo: <NULL>(0) // WillDo: Remove Element: // DidDo: Remove Element: (0) // WillDo: Create Element: special text node tag // DidDo: Create Element: special text node tag(0) // WillDo: Insert Text: a // DidDo: Insert Text: a(0) // WillEndBatch: 0 // DidEndBatch: 0 (0) selRanges = [ [ [[0, 1, 0], 1], [[0, 1, 0], 1] ] ]; EditorSetSelectionFromOffsets(selRanges); window.editorShell.InsertText("b"); // WillBeginBatch: 0 // DidBeginBatch: 0 (0) // WillDo: <NULL> // DidDo: <NULL>(0) // WillEndBatch: 0 // DidEndBatch: 0 (0) selRanges = [ [ [[0, 1, 0], 2], [[0, 1, 0], 2] ] ]; EditorSetSelectionFromOffsets(selRanges); window.editorShell.InsertText("c"); // WillBeginBatch: 0 // DidBeginBatch: 0 (0) // WillDo: <NULL> // DidDo: <NULL>(0) // WillEndBatch: 0 // DidEndBatch: 0 (0) window.editorShell.Undo(); // WillUndoBatch // WillUndo: <NULL> // DidUndo: <NULL>(0) // EndUndoBatch (0) window.editorShell.Undo(); // WillUndoBatch // WillUndo: <NULL> // DidUndo: <NULL>(0) // EndUndoBatch (0) window.editorShell.Undo(); // WillUndoBatch // WillUndo: Insert Text: a // DidUndo: Insert Text: a(0) // WillUndo: Create Element: special text node tag // DidUndo: Create Element: special text node tag(0) // WillUndo: Remove Element: // DidUndo: Remove Element: (0) // WillUndo: <NULL> // DidUndo: <NULL>(0) // EndUndoBatch (0)
accepting bugs; setting to m11
i'll probably check what Kin suggests, this weekend - but i suspect that paste is not going to have the expected undo behavior without some more serious alterations.
I was under the impression that undoing of paste has been working fine (plaintext paste, anyway; there was a bug with undoing html insertions, which is fixed now). What unexpected behavior do you think paste will have, and did it have that unexpected behavior before?
Joe, if are worried about the InsertText transactions, created by the paste, absorbing other InsertText transactions generated by the user typing or another paste, that can be solved by adding begin/end batch calls to the paste code to prevent merging.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
fixed
Status: RESOLVED → REOPENED
still a problem I believe... I typed: "Undo" in the first line. Then I pulled down Edit | Undo. The result was: "U". SHouldn't it all be merged into one undo?
Resolution: FIXED → ---
Clearing FIXED resolution due to reopen of this bug.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
this works for me and sfraser@netscape.com. Resolve as fixed. Sujay: can you please retest and let us know which platforms have this problem or if there are any extra steps or ??? thanks!!!
Status: RESOLVED → REOPENED
I just tried it on Linux; if I typed undo in the middle of an existing text node, Undo undid the whole world, but if I preceded it with a select-all/click/backspace and typed undo in a new document, it removed the ndo but left the U.
yes I'm seeing the same thing what Akkana is seeing on Windows also...
Resolution: FIXED → ---
I only see this problem if I select all and then press delete and then type or if I get a blank page (from the browser) and begin typing.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
fixed
Status: RESOLVED → VERIFIED
verified in 9/21 build.
Whiteboard: [PDT]+
Putting on [PDT]+ radar.
You need to log in before you can comment on or make changes to this bug.