mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
Reset LastVisualX on undo/redo
In cursor's Goto(), which is currently only used by undo and redo, we restore remembered LastVisualX and LastWrappedVisualX values. But if the window had been resized in the meantime, the LastWrappedVisualX may not be valid anymore. So it may cause the cursor moving to unexpected locations. So for simplicity just reset these values on undo or redo, instead of using remembered ones.
This commit is contained in:
parent
6214abba9a
commit
134cd999c6
@ -67,8 +67,9 @@ func (c *Cursor) Buf() *Buffer {
|
||||
// Goto puts the cursor at the given cursor's location and gives
|
||||
// the current cursor its selection too
|
||||
func (c *Cursor) Goto(b Cursor) {
|
||||
c.X, c.Y, c.LastVisualX, c.LastWrappedVisualX = b.X, b.Y, b.LastVisualX, b.LastWrappedVisualX
|
||||
c.X, c.Y = b.X, b.Y
|
||||
c.OrigSelection, c.CurSelection = b.OrigSelection, b.CurSelection
|
||||
c.StoreVisualX()
|
||||
}
|
||||
|
||||
// GotoLoc puts the cursor at the given cursor's location and gives
|
||||
|
Loading…
Reference in New Issue
Block a user