cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

[keyboard] Better support for multi-target actions (ie "bring" / "move" / "swap")

Open pokey opened this issue 3 years ago • 2 comments
trafficstars

  • [ ] Add action which creates a named mark. Like a lightweight version of #46. Note that we'll probably want to arrange for this action not to set the that mark, because we'll want to keep that unchanged
  • [ ] Add a keyboard shortcut that switches the action to use this new create named mark action, and create a mark called destination. This keyboard shortcut will by default set the destination mark to be the current selection. Then selecting a hat will target this special destination mark instead of just the usual that mark
  • [ ] Applying a scope expansion or other modifier will target both that mark and destination mark
  • [ ] Need equivalent to just that breaks the chain, so that it doesn't target that, only destination (see also #1004)
  • [ ] Need to figure out how to highlight this mark in a different color
  • [ ] Then have set of actions for the following:
    • [ ] "move after"
    • [ ] "move before"
    • [ ] "move to"
    • [ ] "bring after"
    • [ ] "bring before"
    • [ ] "bring to"
    • [ ] "swap"

Btw this kind of jives with an idea @AndreasArvidsson and I were talking about, where you have one target with named attributes instead of a list of targets.

Feels like this moves towards a viewpoint that Cursorless is really allowing us to have named / differentiated cursors

pokey avatar Oct 02 '22 13:10 pokey

Here is how the current keyboard implementation works fundamentally:

  1. A mark is selected
  2. The mark is highlighted which makes it available through that target
  3. Further modifiers or actions are then always applied as a highlighting of the that target which makes the modified target again available through that.

In my experiment #1964 I do not use the that mark to chain modifiers. Instead I manually track and extend/modify every target in a list of targets. This opens the possibility to have an keyboard action like designate last target in list as destination. Or a toggle that allows the user to set the destination target explicitly. Any 2-target actions would either use cursor if the destination target is null or use the destination target if it is set.

This basically moves the proposed feature #46 into the keyboard mode only.

Having a list of targets gives more flexibility to the keyboard mode implementation. However, I am not familiar enough with more advanced features (e.g. experimental.setInstanceReference) to figure out if that flexibility is actually helpful or just unnecessary complexity. For example: can we apply a experimental.setInstanceReference to a that target?

Kn0rk avatar Oct 25 '23 16:10 Kn0rk

  • Would maybe be some kind of special target
  • Would need to figure out how to make "inference" work, ie you set source then destination then if you run a modifier it modifies them all
  • Need to think about interaction with some kind of "just"

pokey avatar Jun 17 '24 12:06 pokey