Open imkzh opened 3 years ago
Let's first try to find out what command executes on your machine, with your settings and your keybindings when pressing shift+right
. Could you please try the following:
Developer: Toggle Keyboard Shortcuts Troubleshooting
shift+right
)If you are having trouble understanding the output, please feel free to paste here and I can try to help.
Here is the output from keyboard shortcuts troubleshooting console: (manually formatted)
it seems the problem is related to Column Selection Mode
(i turned it on because i was working on some text based table from terminal output). @alexdima
# scope: column selection mode enabled:
# action: holding alt and click to insert some carets:
[2020-12-08 16:44:29.395] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [alt], code: AltLeft, keyCode: 18, key: Alt
[2020-12-08 16:44:29.395] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltLeft, keyCode: 6 ('Alt')
[2020-12-08 16:44:29.396] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
# action: press shift+right
[2020-12-08 16:44:41.331] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 16, key: Shift
[2020-12-08 16:44:41.331] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 4 ('Shift')
[2020-12-08 16:44:41.331] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2020-12-08 16:44:41.555] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [shift], code: ArrowRight, keyCode: 39, key: ArrowRight
[2020-12-08 16:44:41.555] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: ArrowRight, keyCode: 17 ('RightArrow')
[2020-12-08 16:44:41.555] [renderer1] [info] [KeybindingService]: | Resolving shift+[ArrowRight]
[2020-12-08 16:44:41.555] [renderer1] [info] [KeybindingService]: \ From 2 keybinding entries, matched cursorColumnSelectRight, when: editorColumnSelection && textInputFocus, source: built-in.
# scope: column selection mode disabled:
# (in this scope, adjusting/initiating selection works fine)
# action: hold alt and click to insert some carets:
[2020-12-08 16:46:31.764] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [alt], code: AltLeft, keyCode: 18, key: Alt
[2020-12-08 16:46:31.765] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltLeft, keyCode: 6 ('Alt')
[2020-12-08 16:46:31.765] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
# action: press shift+right
[2020-12-08 16:46:40.241] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 16, key: Shift
[2020-12-08 16:46:40.241] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 4 ('Shift')
[2020-12-08 16:46:40.241] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2020-12-08 16:46:40.469] [renderer1] [info] [KeybindingService]: / Received keydown event - modifiers: [shift], code: ArrowRight, keyCode: 39, key: ArrowRight
[2020-12-08 16:46:40.469] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: ArrowRight, keyCode: 17 ('RightArrow')
[2020-12-08 16:46:40.470] [renderer1] [info] [KeybindingService]: | Resolving shift+[ArrowRight]
[2020-12-08 16:46:40.470] [renderer1] [info] [KeybindingService]: \ From 2 keybinding entries, matched cursorRightSelect, when: textInputFocus, source: built-in.
@imkzh Thank you for the extra information. This works as expected, when in column selection mode, the multiple cursors will always try to become aligned by columns (like a box).
By the way, the Selection > Column Selection Mode
toggle is just one of multiple ways to create column selection. You can also:
"editor.multiCursorModifier": "ctrlCmd"
and then do regular mouse selection and press alt
to have it become a column selectioncursorColumnSelectDown
, cursorColumnSelectLeft
, cursorColumnSelectRight
or cursorColumnSelectUp
@alexdima thank you for the alt-key
modifier solution.
But I still think there would be a bug. The carets can stay aligned or become unaligned after moving, even with carets still aligned, i could not initiate selection with keyboard.
Maybe we can make the program to check if the carets are still aligned before exiting the multi caret mode.
In column selection mode, make the following selection:
contents in []
are selected, and a |
denotes a caret.
L[or]|em ipsum dolor sit amet,
b[la]|h blah blah blah
f[oo]| bar
moving carets left will cancel the selection, but they are still aligned:
L|orem ipsum dolor sit amet,
b|lah blah blah blah
f|oo bar
and shift+right
to initiate a new selection:
what i expected:
L[o]|rem ipsum dolor sit amet,
b[l]|ah blah blah blah
f[o]|o bar
what i got:
L[o]|rem ipsum dolor sit amet,
blah blah blah blah
foo bar
@imkzh How did you create the initial state?
L[or]|em ipsum dolor sit amet,
b[la]|h blah blah blah
f[oo]| bar
@alexdima under column selection mode, click down after L
on the first line and drag to select second o
on the third line.
Still reproducable:
Seems like in column-selection mode, shift+left/right does not work for multi-cursors.
@alexdima What is the difference between CursorColumnSelectLeft
and CursorLeftSelect
?
ColumnSelectCommand
does not seem to be multi-cursor ready (it only uses primary cursor).
CursorLeftSelect
is the regular shift+left
that can result that multiple cursors become "unaligned" e.g.
CursorColumnSelectLeft
is only bound by default on Windows I believe and makes sure the result is a "column" selection (i.e. box selection). It also does not loop back to the end of the previous line, etc.
When multiple carets are inserted, no matter with or without selections, pressing
shift-left
orshift-right
exits the multi-caret mode (in some cases), and selecting texts only under the first caret, instead of initiate(or adjust) text selections for every caret.Scenario:
shift+up/down
, then text selection works fine.alt
) orcolumn selection mode
, selection failed to initiate correctly.shift-end/home
works fine in both situation, but after that, pressingshift-left/right
exits the multi-caret mode, and deselects texts under all other carets.ctrl-d
(named "Add selection to next find match"), too.As i remembered, there was a time when i could adjust multiple text selections simultaneously/synchronized.(confirmed: that is PyCharm instead of vscode)It seems adjusting multiple selection will only work when all carets are "aligned" and "not modified yet", at present. Would this be a bug?
Also:
move lines up and down
does not work under multi-caret mode either, but this seems unrelated to this issue (i'm too lazy to submit this in a new issue).======================
Tested: behaves exactly the same when all extensions are disabled.
======================
Version: 1.51.1 Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f Date: 2020-11-10T23:31:29.624Z (3 wks ago) Electron: 9.3.3 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Linux x64 4.15.0-23-generic (note: Ubuntu 16.04)