Skip to content

Commit 0d51035

Browse files
committed
undo/redo: Remove no longer needed teCursor temp var
1 parent 658c20f commit 0d51035

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

internal/buffer/eventhandler.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,9 @@ func (eh *EventHandler) UndoOneEvent() {
291291
eh.UndoTextEvent(t)
292292

293293
// Set the cursor in the right place
294-
teCursor := t.C
295-
if teCursor.Num >= 0 && teCursor.Num < len(eh.cursors) {
296-
eh.cursors[teCursor.Num].Goto(teCursor)
297-
eh.cursors[teCursor.Num].NewTrailingWsY = teCursor.NewTrailingWsY
298-
} else {
299-
teCursor.Num = -1
294+
if t.C.Num >= 0 && t.C.Num < len(eh.cursors) {
295+
eh.cursors[t.C.Num].Goto(t.C)
296+
eh.cursors[t.C.Num].NewTrailingWsY = t.C.NewTrailingWsY
300297
}
301298

302299
// Push it to the redo stack
@@ -335,12 +332,9 @@ func (eh *EventHandler) RedoOneEvent() {
335332
return
336333
}
337334

338-
teCursor := t.C
339-
if teCursor.Num >= 0 && teCursor.Num < len(eh.cursors) {
340-
eh.cursors[teCursor.Num].Goto(teCursor)
341-
eh.cursors[teCursor.Num].NewTrailingWsY = teCursor.NewTrailingWsY
342-
} else {
343-
teCursor.Num = -1
335+
if t.C.Num >= 0 && t.C.Num < len(eh.cursors) {
336+
eh.cursors[t.C.Num].Goto(t.C)
337+
eh.cursors[t.C.Num].NewTrailingWsY = t.C.NewTrailingWsY
344338
}
345339

346340
// Modifies the text event

0 commit comments

Comments
 (0)