Fix tabstop sizing with mix of tabs and spaces

Fixes #404
This commit is contained in:
Zachary Yedidia
2016-10-10 21:44:16 -04:00
parent 38bf8c0225
commit 8f5f8ffdd6

View File

@@ -687,7 +687,7 @@ func (v *View) InsertTab(usePlugin bool) bool {
// Insert a tab
if v.Buf.Settings["tabstospaces"].(bool) {
tabSize := int(v.Buf.Settings["tabsize"].(float64))
if remainder := v.Cursor.Loc.X % tabSize; remainder != 0 {
if remainder := v.Cursor.GetVisualX() % tabSize; remainder != 0 {
tabSize = tabSize - remainder
}
v.Buf.Insert(v.Cursor.Loc, Spaces(tabSize))