-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Description
I've encountered an unexpected bug in the undo behavior of the CodeArea. It seems that when pressing Enter after selecting text, and then performing an undo (CTRL+Z), the caret is not restored to its original position. Instead, it ends up one character before the end of the original selection.
Steps to Reproduce
- In a
CodeArea, type any text — for example:Something, - Select a portion of the text — e.g., select
"eth"inSom[eth]ing, - Press
Enter— the result will beSom\ningwith the caret positioned at the start of the second line, - Press
CTRL+Zto undo — the text reverts toSomething, but the caret is now placed after the letter't'instead of its original position and there is no selection.
Expected Behavior
The undo operation should restore both:
- The original selection range
- The caret position exactly as it was before pressing
Enter
Additional Notes
- Selection direction matters: selecting from
'e'to'h'vs.'h'to'e'should not affect the final caret position after undo. - The caret should consistently return to its pre-
Enterlocation regardless of selection direction.
Update: I suspect the issue is in the UndoManager, so it might be a bug to be reported there instead, I will look for the root cause.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels