From 0d51035acd4419b12886e7cec5e651c489d0ef44 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 4 Aug 2024 13:56:03 +0200 Subject: [PATCH] undo/redo: Remove no longer needed teCursor temp var --- internal/buffer/eventhandler.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/internal/buffer/eventhandler.go b/internal/buffer/eventhandler.go index 2f3183ee..10104f9c 100644 --- a/internal/buffer/eventhandler.go +++ b/internal/buffer/eventhandler.go @@ -291,12 +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) { - 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 @@ -335,12 +332,9 @@ func (eh *EventHandler) RedoOneEvent() { return } - teCursor := t.C - if teCursor.Num >= 0 && teCursor.Num < len(eh.cursors) { - 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