micro icon indicating copy to clipboard operation
micro copied to clipboard

add NewCursor binding for lua plugins

Open mosskjohnson opened this issue 2 years ago • 4 comments

This adds a binding to the NewCursor function for use in lua plugins.

mosskjohnson avatar Sep 29 '23 20:09 mosskjohnson

Just moved it.

mosskjohnson avatar Mar 27 '24 00:03 mosskjohnson

Still, what about my question https://github.com/zyedidia/micro/issues/2920#issuecomment-1753917310?

I.e. isn't NewCursor() too low-level a detail to be exposed to plugins? Perhaps the needed functionality can be already achieved from Lua with existing BufPane methods like SpawnMultiCursor()? Or if those methods are not quite suitable since they do "too much", perhaps we should just add a new simple method to BufPane or to Buffer, which would, roughly speaking, just do NewCursor() + AddCursor() + MergeCursors() and nothing else?

dmaluka avatar Mar 30 '24 14:03 dmaluka

Hi,

I would like to see three changes in multicursor behavior:

  1. Make multiple text selections, each with a cursor:
  • Ctrl+Left+Click+Drag - Region
  • Ctrl+DoubleClick - Word
  • Ctrl+TripleClick - Line
  1. New actions ( see https://github.com/zyedidia/micro/issues/2920)
  • SpawnMultiCursorAll - Search with current selection or current word, and select all for editing.
  • SpawnMultiCursorFound - Select/edit all matches for last find, allows literal or regex searches. NB. Using the search facility will allow easy highlighting or scrolling to review all the selections before editing.
  1. Merge contiguous cursors on the same line
  • Delete selections before any editing

SciTE does 1+3 for an example of functionality.

Kind Regards Gavin Holt

Gavin-Holt avatar Jun 16 '24 23:06 Gavin-Holt

With #3441 merged, cursors can now be added via bp:SpawnCursorAtLoc() instead.

dmaluka avatar Aug 31 '24 12:08 dmaluka