timhor/obsidian-editor-shortcuts

Select line unusual (moves cursor to end of line)

Closed this issue · 5 comments

reagle commented

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

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

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

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

This has been fixed in v1.14.0

reagle commented

Confirm fixed. Thank you!