I’m trying to add a feature to CodeMirror 6 where I can insert multiple tabs on multiple lines. I’ve been able to figure out how to insert the tabs on multiple lines, but I’m unable to figure out how to move the cursors forward. Four spaces are inserted, so I want to move all the cursors forward by four characters.
I’ve tried:
View.dispatch({ selection: { anchor: … } }); // however, this returns to a single line cursor since we are only modifying “anchor”
Attempting to modify EditorSelection start, goalColumn, etc, but these are all getters.
Attempting to “moveVertically” but got runtime exceptions.
Map the existing selection through your changes (with assoc set to 1, so it moves forward), and include that as selection field in the same transaction that makes the changes.
It would be easier to create a ChangeSet for your changes and pass that to both EditorSelection.map and dispatch, rather than implementing your own mapPos.