parent
204a763dff
commit
5da6b31b9c
2 changed files with 10 additions and 1 deletions
|
@ -309,6 +309,16 @@ func (v *View) Delete() bool {
|
|||
func (v *View) InsertTab() bool {
|
||||
// Insert a tab
|
||||
if v.Cursor.HasSelection() {
|
||||
if v.Cursor.CurSelection[0].Y != v.Cursor.CurSelection[1].Y {
|
||||
for i := v.Cursor.CurSelection[0].Y; i <= v.Cursor.CurSelection[1].Y; i++ {
|
||||
if settings["tabstospaces"].(bool) {
|
||||
v.Buf.Insert(Loc{0, i}, Spaces(int(settings["tabsize"].(float64))))
|
||||
} else {
|
||||
v.Buf.Insert(Loc{0, i}, "\t")
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
v.Cursor.DeleteSelection()
|
||||
v.Cursor.ResetSelection()
|
||||
}
|
||||
|
|
|
@ -293,7 +293,6 @@ func (c *Cursor) Start() {
|
|||
func (c *Cursor) GetCharPosInLine(lineNum, visualPos int) int {
|
||||
// Get the tab size
|
||||
tabSize := int(settings["tabsize"].(float64))
|
||||
// This is the visual line -- every \t replaced with the correct number of spaces
|
||||
visualLineLen := StringWidth(c.buf.Line(lineNum))
|
||||
if visualPos > visualLineLen {
|
||||
visualPos = visualLineLen
|
||||
|
|
Loading…
Reference in a new issue