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

RESOLVED FIXED in 0.3

Status

Skywriter
Editor
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: Alex Iskander, Assigned: GPHemsley)

Tracking

Details

(Reporter)

Description

9 years ago
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.
(Assignee)

Comment 1

9 years ago
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
(Assignee)

Comment 2

9 years ago
(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
(Assignee)

Comment 3

9 years ago
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.
(Assignee)

Comment 4

9 years ago
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
(Assignee)

Updated

9 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 5

9 years ago
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/
(Assignee)

Comment 6

9 years ago
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
Last Resolved: 9 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
(Assignee)

Updated

9 years ago
Target Milestone: 0.2.4 → 0.3.0
You need to log in before you can comment on or make changes to this bug.