timhor / obsidian-editor-shortcuts

Obsidian plugin to add keyboard shortcuts commonly found in code editors such as Visual Studio Code (vscode) or Sublime Text
MIT License
330 stars 23 forks source link

Select line unusual (moves cursor to end of line) #64

Closed reagle closed 1 year ago

reagle commented 1 year ago

Thanks for the plugin!

I'm using Select line (repeat to keep expanding selection) and it has odd behavior -- at least to my expectations in Sublime Text and Visual Studio Code. If I select this command three times on the following code and then "add cursor to line ends" (in VSC) or "Split selection into lines" (in ST4), I have three cursors, at the end of each line.

This is a test;
of the emergency broadcasting system.
If this had been a real test...
SCR-20230505-mjrl

Your plugins adds a fourth cursor on the following blank line, which confuses multi-cursor edits. (The screen capture only caught one cursor, they blink out of time with each other, but there are four.)

SCR-20230505-mjvf
timhor commented 1 year ago

Ah I see what's going on – Sublime and VS Code don't add a cursor to the final line if it's blank.

Should be a easy fix for this edge case.

reagle commented 1 year ago

I don’t think it’s just for a final blank line, though that’s the context in which I first encountered this. If I select three lines among five and split, I should have three cursors, whether the following line was empty or not.

timhor commented 1 year ago

Oh yep you're right – it's happening because select line always selects until the beginning of the next line. I'll fix up the behaviour for adding cursors / splitting selections.

timhor commented 1 year ago

This has been fixed in v1.14.0

reagle commented 1 year ago

Confirm fixed. Thank you!