Skip to content

Commit

Permalink
undo/redo: Remove no longer needed teCursor temp var
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaluka committed Aug 4, 2024
1 parent 658c20f commit 0d51035
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions internal/buffer/eventhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0d51035

Please sign in to comment.