mirror of
https://github.com/zyedidia/micro.git
synced 2024-09-11 12:15:52 +03:00
Merge pull request #3416 from dmaluka/undo-cursor-fix
Fix cursor moving to an unexpected location after a redo
This commit is contained in:
commit
3737979139
@ -291,13 +291,9 @@ func (eh *EventHandler) UndoOneEvent() {
|
||||
eh.UndoTextEvent(t)
|
||||
|
||||
// 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 {
|
||||
teCursor.Num = -1
|
||||
if t.C.Num >= 0 && t.C.Num < len(eh.cursors) {
|
||||
eh.cursors[t.C.Num].Goto(t.C)
|
||||
eh.cursors[t.C.Num].NewTrailingWsY = t.C.NewTrailingWsY
|
||||
}
|
||||
|
||||
// Push it to the redo stack
|
||||
@ -336,13 +332,9 @@ func (eh *EventHandler) RedoOneEvent() {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
teCursor.Num = -1
|
||||
if t.C.Num >= 0 && t.C.Num < len(eh.cursors) {
|
||||
eh.cursors[t.C.Num].Goto(t.C)
|
||||
eh.cursors[t.C.Num].NewTrailingWsY = t.C.NewTrailingWsY
|
||||
}
|
||||
|
||||
// Modifies the text event
|
||||
|
Loading…
Reference in New Issue
Block a user