Skip to content

Implement undo - #14

Merged
ppedemon merged 11 commits into
mainfrom
undo
Nov 6, 2026
Merged

ppedemon merged 11 commits into
mainfrom
undo

Conversation

@ppedemon

@ppedemon ppedemon commented Nov 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

Undo seems to work for changes done in insert mode.

Next: incorporate extra commands. For that I need to add further undo txn demarcations.
Computing dmage for an arbitrary set of undo transactions is tricky, since the damage won't be localized, and every extent might be affected by actions executed before.

Out approach: record original line numbers, in addition to char indexes.  If any chunk in a transaction has multiline scope, use the min line number for destroying from. Using the smaller line number is safe.

If all chunks are single line, then joining all chunks using interval union will be safe. Since no lines were added or deleted, line numbers are still valid. Then we can do a destroy range or destroy line.
@ppedemon
ppedemon merged commit a80ff1c into main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant