Closed nobellium1997 closed 2 years ago
Thanks for the report!
Are you using a formatter on the after-change hook? Without a formatter, I'm able to reproduce the erroneous "could not restore" message, but not the cursor issue you're describing. I've noticed some formatters attempt to preserve the point location which conflicts with tree-edit's overlay. Unfortunately I can't think of any way to address this from the tree-edit directly. If that is what you're running into, you'll have to wrap the function like so:
(defun format-and-update-overlay ()
(+format/buffer)
(evil-tree-edit--update-overlay))
Ah I am not and I just saw the part in the getting started guide about adding a formatter as a hook. I think adding a formatter will probably help fix the issue I'm seeing so I'll just close this issue and if I do run into more problems, I'll give a heads up. Thanks for the help!
I think the formatter will make things worse actually, but I've got a fix coming for that shortly.
When raising inside of a wrapping statement, the location of the cursor gets put towards the end of the previous line which confuses tree-edit, forcing you to exit out of tree-edit state, reposition your cursor, and re-enable tree-edit state.
Repro steps:
Example:
Raising the print call should repro the issue.
This is using emacs 28 on tree-editor commit 6d8e495169d4e6bb98b3cd1a1a0a06cc806c5e59