Skip to content

Commit 70dfc7f

Browse files
fix drawing of wide characters in InfoWindow (#3919)
1 parent a2620d1 commit 70dfc7f

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

internal/display/infowindow.go

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,8 @@ func (i *InfoWindow) displayBuffer() {
122122

123123
}
124124

125-
rw := runewidth.RuneWidth(r)
126-
for j := 0; j < rw; j++ {
127-
c := r
128-
if j > 0 {
129-
c = ' '
130-
combc = nil
131-
}
132-
screen.SetContent(vlocX, i.Y, c, combc, style)
133-
}
134-
vlocX++
125+
screen.SetContent(vlocX, i.Y, r, combc, style)
126+
vlocX += runewidth.RuneWidth(r)
135127
}
136128
nColsBeforeStart--
137129
}
@@ -142,29 +134,22 @@ func (i *InfoWindow) displayBuffer() {
142134
curBX := blocX
143135
r, combc, size := util.DecodeCharacter(line)
144136

145-
draw(r, combc, i.defStyle())
146-
147137
width := 0
148138

149-
char := ' '
150139
switch r {
151140
case '\t':
152-
ts := tabsize - (totalwidth % tabsize)
153-
width = ts
141+
width = tabsize - (totalwidth % tabsize)
142+
for j := 0; j < width; j++ {
143+
draw(' ', nil, i.defStyle())
144+
}
154145
default:
155146
width = runewidth.RuneWidth(r)
156-
char = '@'
147+
draw(r, combc, i.defStyle())
157148
}
158149

159150
blocX++
160151
line = line[size:]
161152

162-
// Draw any extra characters either spaces for tabs or @ for incomplete wide runes
163-
if width > 1 {
164-
for j := 1; j < width; j++ {
165-
draw(char, nil, i.defStyle())
166-
}
167-
}
168153
if activeC.X == curBX {
169154
screen.ShowCursor(curVX, i.Y)
170155
}

0 commit comments

Comments
 (0)