Closed Bug 494709 Opened 16 years ago Closed 16 years ago

Undo/redo of replacing selected text assumes old text remains selected

Categories

(Skywriter Graveyard :: Editor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alex, Assigned: GPHemsley)

Details

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/528.18.1 (KHTML, like Gecko) Version/4.0 Safari/528.17 Build Identifier: 7d58f6bc9828 The entire undo/redo mechanism seems to go seriously wonky if you redo a deletion or replacement of text that was previously selected after deselecting the text. Reproducible: Always Steps to Reproduce: 1. Create a document in Bespin. 2. Type in some text ("Hello, World!" in this example) 3. Select a chunk ("Hello") 4. Type in something (letter "I", making "I, World") 5. Undo. -- "Hello, World!" reappears 6. Deselect everything (move cursor to end of line) 7. Redo. 8. For extra fun, undo again. Actual Results: After step seven, you get IHello, World! Which is obviously not proper. If you follow step eight and undo the redo, you get something even worse: HelloHello, World! Expected Results: After step seven, this should have been the result: I, World! After step eight, this should have been the result: Hello, World! I think that something related to the undo manager is supposed to, somehow, replace the selection so that the actions which operate on the selection will still function properly. Otherwise, these undo actions should not reference the selection at all.
I'm unable to produce this on the latest tip. Are you sure it's not a result of your own code modifications?
Version: unspecified → Trunk
(In reply to comment #1) > I'm unable to produce this on the latest tip. Are you sure it's not a result of > your own code modifications? Sorry, I take that back. I was doing the steps in the wrong order. This is present, so confirming.
Status: UNCONFIRMED → NEW
Ever confirmed: true
By the way, the problem is that the undo/redo function calls are assuming that the current selection is what is to be replaced. If you move the cursor—or, even worse, select something else—the undo/redo actions will not take that into consideration. I'm looking into it.
I've fixed this with regard to inserting one character over a selection. This bug is still present, however, when inserting a chunk (e.g. by pasting) over a selection. I'm looking to tackle that next. Here's the changeset: http://bitbucket.org/gphemsley/bespin/changeset/2945edf6a8ce/
Assignee: nobody → gphemsley
Status: NEW → ASSIGNED
The undo/redo of inserting of chunks over selected text is also fixed, but there's still another problem that I'm trying to track down. I don't think it's related to my code changes, but I'm not sure yet. Either way, here's the new changeset (the debug code was removed in a subsequent changeset): http://bitbucket.org/gphemsley/bespin/changeset/1b534788e87a/
This stuff was merged into tip last week, so I think I'm going to mark this as RESOLVED FIXED. If you find (or anyone else finds) that bug I was referring to in comment 5, kindly file a new bug with a more specific summary and description.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Summary: redoing deletion/replacement of selected text fails after selection changed → Undo/redo of replacing selected text assumes old text remains selected
Target Milestone: --- → 0.2.4
Target Milestone: 0.2.4 → 0.3.0
You need to log in before you can comment on or make changes to this bug.