focus-editor / focus

A simple and fast text editor
GNU General Public License v3.0
1.81k stars 99 forks source link

A couple of multicursor improvements you might like #431

Closed onelivesleft closed 1 month ago

onelivesleft commented 1 month ago

Amended creating cursors above/below: If the current cursor is not at the start of the line, when the user creates a cursor above or below it, empty lines will be skipped. This is a lot more ergonomic; almost always this is what the user wants to do. The old behaviour is preserved when the cursor is at the start of the line (for instance, when on an empty line).

create_cursors_around keybind: Cursors will be added to every contiguous line above and below the current cursor as long as the line in question reaches to the cursor column.

focus-editor commented 1 month ago

Overall a very good change.

Two things which bother me a bit:

  1. When the cursor is on an empty line and you use create_cursors_around, it will add cursors to every line. I don't think we want that?
  2. When there's more than one cursor on 2 different paragraphs. If you create_cursors_around, it will create cursors around the first cursor but not the second. I would expect it to either be disabled in multicursor mode or work on both cursors
onelivesleft commented 1 month ago
  1. Nope, will fix that.
  2. Agreed, will fix that too!
onelivesleft commented 1 month ago

Now handles starting with mutiple cursors (by growing from each). Now has good behaviors for all starting conditions:

  1. If starting cursor is mid-line, grow into lines which are at least as long.
  2. If starting cursor is at the start of a line, grow into non-empty lines.
  3. If starting cursor is on an empty line, grow into empty lines.
focus-editor commented 1 month ago

Now working perfectly, thanks!