cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Make "take" preserve semantics of the target that is selected

Open pokey opened this issue 1 year ago • 0 comments

Instead of having a "from" that sets a special implicit target (see https://github.com/cursorless-dev/cursorless/pull/2155), we would like to use "take". The problem is that you lose the rich semantics of the target. Eg "take arg chuck this" won't clean up the comma

The solution

  • the "take" action will also set a special target at the same position that it sets the cursor
  • we highlight the target, so that the cursor highlight color will change
  • next time they issue a command that uses "this" or implicit mark, it will use the stored target instead of just raw selection
  • if selection changes before selection is used, we drop the target
  • as extra credit, we keep a list of past targets so that if they "curse undo", we can restore the old stored target

See https://github.com/cursorless-dev/cursorless/pull/2155#issuecomment-1893488355

pokey avatar Jan 18 '24 11:01 pokey