mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-30 21:00:26 +00:00
Correct the number of spaces to add when a tab is inserted at an offset cursor.
Fixes #268
This commit is contained in:
parent
5b7fa01825
commit
187ea0da1c
1 changed files with 3 additions and 0 deletions
|
|
@ -687,6 +687,9 @@ 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 {
|
||||
tabSize = tabSize - remainder
|
||||
}
|
||||
v.Buf.Insert(v.Cursor.Loc, Spaces(tabSize))
|
||||
for i := 0; i < tabSize; i++ {
|
||||
v.Cursor.Right()
|
||||
|
|
|
|||
Loading…
Reference in a new issue