mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Draw tab characters correctly
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import "strconv"
|
||||
|
||||
func (v *View) DisplayView() {
|
||||
tabsize := int(v.Buf.Settings["tabsize"].(float64))
|
||||
if v.Type == vtLog {
|
||||
// Log views should always follow the cursor...
|
||||
v.Relocate()
|
||||
@@ -70,6 +71,8 @@ func (v *View) DisplayView() {
|
||||
screenX++
|
||||
}
|
||||
|
||||
lineStr := v.Buf.Line(realLineN)
|
||||
|
||||
// If there are gutter messages we need to display the '>>' symbol here
|
||||
if hasGutterMessages {
|
||||
// msgOnLine stores whether or not there is a gutter message on this line in particular
|
||||
@@ -156,23 +159,21 @@ func (v *View) DisplayView() {
|
||||
}
|
||||
|
||||
var lastChar *Char
|
||||
for i, char := range line {
|
||||
for _, char := range line {
|
||||
if char != nil {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == char.realLoc.Y && v.Cursor.X == char.realLoc.X {
|
||||
screen.ShowCursor(xOffset+char.visualLoc.X, char.visualLoc.Y)
|
||||
}
|
||||
screen.SetContent(xOffset+char.visualLoc.X, char.visualLoc.Y, char.char, nil, char.style)
|
||||
if i == len(line)-1 {
|
||||
lastChar = char
|
||||
}
|
||||
screen.SetContent(xOffset+char.visualLoc.X, char.visualLoc.Y, char.drawChar, nil, char.style)
|
||||
lastChar = char
|
||||
}
|
||||
}
|
||||
|
||||
if lastChar != nil {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == lastChar.realLoc.Y && v.Cursor.X == lastChar.realLoc.X+1 {
|
||||
screen.ShowCursor(xOffset+lastChar.visualLoc.X+1, lastChar.visualLoc.Y)
|
||||
screen.ShowCursor(xOffset+StringWidth(string(lineStr), tabsize), lastChar.visualLoc.Y)
|
||||
}
|
||||
} else if len(line) == 0 {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
|
||||
Reference in New Issue
Block a user