diff --git a/cmd/micro/cursor.go b/cmd/micro/cursor.go index a9229039..cf66544e 100644 --- a/cmd/micro/cursor.go +++ b/cmd/micro/cursor.go @@ -65,6 +65,7 @@ type Cursor struct { // It's just a simple wrapper of FromCharPos func (c *Cursor) SetLoc(loc int) { c.x, c.y = FromCharPos(loc, c.v.buf) + c.lastVisualX = c.GetVisualX() } // Loc gets the cursor location in terms of character number instead diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 0eeef74f..cbfe5227 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -286,7 +286,8 @@ func (v *View) OpenFile() { messenger.Error(err.Error()) return } - v.buf = NewBuffer(string(file), filename) + buf := NewBuffer(string(file), filename) + v.OpenBuffer(buf) } }