Undoing backspace of tab replaces tab in the incorrect place



10 years ago
10 years ago


(Reporter: alex, Assigned: alex)





10 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: 29aaa14adf48

Backspacing a tab, and then undoing that backspace, will replace the tab in the wrong place.

Reproducible: Always

Steps to Reproduce:
In bespin.mozilla.com with tabsize=4, tabmode=on
1. Enter some text: abcdefg
2. Move the cursor to the beginning of the line.
3. Press the tab key.
4. Press the backspace/backward delete key.
5. Press Cmd/Ctrl-Z
Actual Results:  
The line reads as:

Where \t is a tab.

Expected Results:  
The line reads as:

Where \t is a tab.

 This is because the cursor position telling Bespin where to replace the tab is at (position backspacing from - 1); that position is a grid position identifier that describes an absolute spot in the editor. If the character being deleted was a tab, the position will be in the MIDDLE of the tab (tab length - 1). So, when undo is called, it tries to insert the tab back at that position, which is now off by (tab length - 1).

This is really two problems: first, the "deleteCharacter" action should make sure its position is correct by calling cursorPosition. Second (although this becomes technically unnecessary when the first is addressed), the "backspace" action should ensure that it has a valid column number when calling deleteCharacter.

Comment 1

10 years ago
A fix is located in:

Along with a couple of other tabmode fixes addressed in a different bug.
I believe this was fixed in changeset 0fc845434ec5, which was merged into tip with changeset 7d58f6bc9828 to fix bug 494348.

At any rate, the bug does not occur with the latest code, so marking this as RESOLVED FIXED.
Assignee: nobody → alex
Last Resolved: 10 years ago
Resolution: --- → FIXED
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.