Set last visual x after SetLoc is called

Fixes #46
This commit is contained in:
Zachary Yedidia
2016-04-20 20:03:53 -04:00
parent 3b4521e9c6
commit 6aab17f445
2 changed files with 3 additions and 1 deletions

View File

@@ -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

View File

@@ -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)
}
}