diff --git a/internal/action/actions.go b/internal/action/actions.go index cf6d954f..ccfb686b 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -657,7 +657,7 @@ func (h *BufPane) InsertNewline() bool { h.Buf.Remove(buffer.Loc{X: 0, Y: h.Cursor.Y - 1}, buffer.Loc{X: util.CharacterCount(line), Y: h.Cursor.Y - 1}) } } - h.Cursor.LastVisualX = h.Cursor.GetVisualX() + h.Cursor.StoreVisualX() h.Relocate() return true } @@ -687,7 +687,7 @@ func (h *BufPane) Backspace() bool { h.Buf.Remove(loc.Move(-1, h.Buf), loc) } } - h.Cursor.LastVisualX = h.Cursor.GetVisualX() + h.Cursor.StoreVisualX() h.Relocate() return true } diff --git a/internal/buffer/cursor.go b/internal/buffer/cursor.go index 7070dc23..784f2d39 100644 --- a/internal/buffer/cursor.go +++ b/internal/buffer/cursor.go @@ -100,7 +100,7 @@ func (c *Cursor) GetCharPosInLine(b []byte, visualPos int) int { // Start moves the cursor to the start of the line it is on func (c *Cursor) Start() { c.X = 0 - c.LastVisualX = c.GetVisualX() + c.StoreVisualX() } // StartOfText moves the cursor to the first non-whitespace rune of @@ -131,7 +131,7 @@ func (c *Cursor) IsStartOfText() bool { // End moves the cursor to the end of the line it is on func (c *Cursor) End() { c.X = util.CharacterCount(c.buf.LineBytes(c.Y)) - c.LastVisualX = c.GetVisualX() + c.StoreVisualX() } // CopySelection copies the user's selection to either "primary" diff --git a/internal/buffer/eventhandler.go b/internal/buffer/eventhandler.go index 10104f9c..e739f250 100644 --- a/internal/buffer/eventhandler.go +++ b/internal/buffer/eventhandler.go @@ -104,7 +104,7 @@ func (eh *EventHandler) DoTextEvent(t *TextEvent, useUndo bool) { c.OrigSelection[0] = move(c.OrigSelection[0]) c.OrigSelection[1] = move(c.OrigSelection[1]) c.Relocate() - c.LastVisualX = c.GetVisualX() + c.StoreVisualX() } if useUndo { diff --git a/runtime/plugins/comment/comment.lua b/runtime/plugins/comment/comment.lua index f86da945..ebb59626 100644 --- a/runtime/plugins/comment/comment.lua +++ b/runtime/plugins/comment/comment.lua @@ -107,7 +107,7 @@ function commentLine(bp, lineN, indentLen) bp.Cursor.Y = curpos.Y end bp.Cursor:Relocate() - bp.Cursor.LastVisualX = bp.Cursor:GetVisualX() + bp.Cursor:StoreVisualX() end function uncommentLine(bp, lineN, commentRegex) @@ -135,7 +135,7 @@ function uncommentLine(bp, lineN, commentRegex) end end bp.Cursor:Relocate() - bp.Cursor.LastVisualX = bp.Cursor:GetVisualX() + bp.Cursor:StoreVisualX() end function toggleCommentLine(bp, lineN, commentRegex)