mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
undo/redo: Don't change remembered cursor location
Remember the cursor location in TextEvent just once - when the original text event happens, so that when we redo after an undo, the cursor is placed at the location where the actual redone modification happens (as the user would expect), not at the location where the cursor was before the undo (which may be a completely unrelated location and may be far away). Fixes #3411
This commit is contained in:
parent
2259fd10af
commit
658c20ff2a
@ -293,7 +293,6 @@ func (eh *EventHandler) UndoOneEvent() {
|
||||
// Set the cursor in the right place
|
||||
teCursor := t.C
|
||||
if teCursor.Num >= 0 && teCursor.Num < len(eh.cursors) {
|
||||
t.C = *eh.cursors[teCursor.Num]
|
||||
eh.cursors[teCursor.Num].Goto(teCursor)
|
||||
eh.cursors[teCursor.Num].NewTrailingWsY = teCursor.NewTrailingWsY
|
||||
} else {
|
||||
@ -338,7 +337,6 @@ func (eh *EventHandler) RedoOneEvent() {
|
||||
|
||||
teCursor := t.C
|
||||
if teCursor.Num >= 0 && teCursor.Num < len(eh.cursors) {
|
||||
t.C = *eh.cursors[teCursor.Num]
|
||||
eh.cursors[teCursor.Num].Goto(teCursor)
|
||||
eh.cursors[teCursor.Num].NewTrailingWsY = teCursor.NewTrailingWsY
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user