sapling icon indicating copy to clipboard operation
sapling copied to clipboard

Have undo and redo keep the cursor in the same/similar position in the tree

Open Protowalker opened this issue 3 years ago • 3 comments

Protowalker avatar Nov 30 '20 19:11 Protowalker

if the undo prevents the node the cursor is on from existing, it should move to the parent.

Protowalker avatar Nov 30 '20 19:11 Protowalker

Alternatively, undo/redo could move the cursor to the site of the undone/redone edit. This is probably more consistent with other editors.

HactarCE avatar Nov 30 '20 22:11 HactarCE

@HactarCE's suggestion is what Sapling should currently do (though there's currently no integration-style unit tests so I can't be sure). The way Sapling currently implements this is to save the location of the cursor along with the root for every undo step - this way, undo/redo will move the cursor to the location of the edit.

However, I'd like Sapling to have multiple selections and cursors (cos it's just an awesome feature that's way easier to add early on in development). In this case, saving the cursor locations is the most intuitive way to deal with multiple selections. It's also what Kakoune does.

But I'm open to ideas and discussion - Sapling is an experiment so anything goes as far as ideas are concerned.

kneasle avatar Nov 30 '20 23:11 kneasle