Fix --preview-window follow not working correctly with wrapping

Fix #3243
Fix #4258
This commit is contained in:
Junegunn Choi
2026-02-18 21:36:23 +09:00
parent 69e9abdab4
commit c338df02c4
6 changed files with 98 additions and 8 deletions
+4 -2
View File
@@ -1423,8 +1423,10 @@ func (w *LightWindow) fill(str string, resetCode string) FillReturn {
for i, line := range allLines {
lines := WrapLine(line, w.posx, w.width, w.tabstop, w.wrapSignWidth)
for j, wl := range lines {
w.stderrInternal(wl.Text, false, resetCode)
w.posx += wl.DisplayWidth
if w.posx < w.width {
w.stderrInternal(wl.Text, false, resetCode)
w.posx += wl.DisplayWidth
}
// Wrap line
if j < len(lines)-1 || i < len(allLines)-1 {