You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first undo record is pushed in the CodeHistoryController constructor. It has the selection collapsed at -1. When changed and undone, that first undo record is applied, and the selection of -1 is somehow converted to 0 which is the beginning of the document.
The quick fix
Find and fix that -1 -> 0 conversion. This would also need a test.
The proper fix
Keep the selection at the edit point when the first edit is undone. Some ideas for this:
When creating an undo record, check if the only record below is the initial one. If so, replace it with another one with the selection as it was before the edit.
When selection changes, always create an undo record. Replace the older top record if it is different from the pre-top only in the selection.
Tests for this:
Go to location A, edit, undo. Expect being at A.
Go to location A, edit, go to location B, go to location C, edit, undo, expect being at C, undo, expect being at A.
vokoscreen-2023-01-05_15-47-59.mp4
The text was updated successfully, but these errors were encountered: