-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Fixing backspace on multiple selection bug #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I've opened an issue for this: #766 |
|
I'm optimistically tagging that as 4.1 (as you wrote a fix ! Thanks !) Ping @ellisonbg |
Fixing backspace on multiple selection bug
|
Are there any updates on this? I'm having the same issue, and I'm running version 6.0.0 |
|
Hi Ben. Given this has been merged for more than 3 years, I don't think any updates are expected. |
|
So actually, I think the issue is more specific than the description suggests. Maybe it is actually a different issue entirely and it makes sense to open a new and different issue. When using multi-cursor, either when using alt+drag or ctrl+click, deleting a space using backspace only deletes on one line, but only sometimes, specifically when there's tablike spaces involved. For an example, consider the text below. Press alt and drag the cursor from before the parentheses on the line that contains Richmond down to the line with San Jose. All lines have a cursor displayed before the parentheses. I indicate this below with a bar If I press backspace, then the text changes to The first tab (which is 4 spaces) is removed, and the rest of them stay the same. If instead, I were to press the right arrow key, press space four times, then press backspace, I end up with this output The Richmond line has three spaces. It seems whatever is processing the delete sees the spaces but recognizes that it's not a tab, so it deletes it like a space, but still only affects the one line. If you keep hitting backspace, it will function normally and it's possible to get to the state below by hitting backspace three times: The line that gets deleted is the one with the last mousedown event, so if I alt+drag, it's where I start dragging, but if I ctrl+click, it's the last spot I clicked. When the "selected" cursor is in the middle of text, deleting occurs normally. The selection below will delete normally if the cursor within the San Jose text is the "selected" cursor, but not if the "selected" cursor is on the Richmond or Virginia Beach line. For example, hitting backspace in the situation below causes no issues. But here does cause issues When typing and when the "selected" cursor is deleting non-space characters, everything works as expected. I tested this in 3 configurations on two machines, and every one produced the issue in the same way. OS Name: Microsoft Windows 10 Pro Chrome Version 75.0.3770.142 (Official Build) (64-bit) Configuration 1: Machine 2: OS Name: Microsoft Windows 10 Education Firefox 68.0.1 Configuration 1: Configuration 2: |
|
Thanks for the great response. I wasn't familiar with multiple cursors. Sounds like an unknown variation of the original and I recommend opening a new issue for this. |
The bug could be reproduced in two ways:
1) Block selection
a) Alt + select a block containing more than one line, and more than one character per line.
b) Hit backspace
Expected result: all the selected content is deleted
Actual result: only the first line of the selection is deleted
2) Multiple selection
a) Select any portion of text
b) Ctrl + select any other portion of text
c) Hit backspace
Expected result: all the selections' contents are deleted
Actual result: only the first selection is deleted
The fix
The portion of code that took care of selection deletion did not take into account multiple selections. The proposed fix simply gets the list of selections and removes them all from last to first.
closes #766