From 70dfc7fcb4d0f53e155fa0d8ac5ea200d8736d16 Mon Sep 17 00:00:00 2001 From: Mikko Date: Thu, 27 Nov 2025 20:45:30 +0200 Subject: [PATCH] fix drawing of wide characters in InfoWindow (#3919) --- internal/display/infowindow.go | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/internal/display/infowindow.go b/internal/display/infowindow.go index 878d40ff..afc0c53f 100644 --- a/internal/display/infowindow.go +++ b/internal/display/infowindow.go @@ -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) }