fix drawing of wide characters in InfoWindow (#3919)

This commit is contained in:
Mikko
2025-11-27 20:45:30 +02:00
committed by GitHub
parent a2620d1c02
commit 70dfc7fcb4

View File

@@ -122,16 +122,8 @@ func (i *InfoWindow) displayBuffer() {
}
rw := runewidth.RuneWidth(r)
for j := 0; j < rw; j++ {
c := r
if j > 0 {
c = ' '
combc = nil
}
screen.SetContent(vlocX, i.Y, c, combc, style)
}
vlocX++
screen.SetContent(vlocX, i.Y, r, combc, style)
vlocX += runewidth.RuneWidth(r)
}
nColsBeforeStart--
}
@@ -142,29 +134,22 @@ func (i *InfoWindow) displayBuffer() {
curBX := blocX
r, combc, size := util.DecodeCharacter(line)
draw(r, combc, i.defStyle())
width := 0
char := ' '
switch r {
case '\t':
ts := tabsize - (totalwidth % tabsize)
width = ts
width = tabsize - (totalwidth % tabsize)
for j := 0; j < width; j++ {
draw(' ', nil, i.defStyle())
}
default:
width = runewidth.RuneWidth(r)
char = '@'
draw(r, combc, i.defStyle())
}
blocX++
line = line[size:]
// Draw any extra characters either spaces for tabs or @ for incomplete wide runes
if width > 1 {
for j := 1; j < width; j++ {
draw(char, nil, i.defStyle())
}
}
if activeC.X == curBX {
screen.ShowCursor(curVX, i.Y)
}