mirror of
https://github.com/zyedidia/micro.git
synced 2024-11-04 01:12:52 +03:00
hltrailingws: simpler and better undo/redo handling
This commit is contained in:
parent
53efce72fa
commit
13d1407f60
@ -107,7 +107,9 @@ func (eh *EventHandler) DoTextEvent(t *TextEvent, useUndo bool) {
|
||||
c.LastVisualX = c.GetVisualX()
|
||||
}
|
||||
|
||||
eh.updateTrailingWs(t)
|
||||
if useUndo {
|
||||
eh.updateTrailingWs(t)
|
||||
}
|
||||
}
|
||||
|
||||
// ExecuteTextEvent runs a text event
|
||||
@ -292,6 +294,7 @@ func (eh *EventHandler) UndoOneEvent() {
|
||||
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
|
||||
}
|
||||
@ -335,6 +338,7 @@ func (eh *EventHandler) RedoOneEvent() {
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user