From 235ef3c95c1304fd2f9eb5f2d320491837bfc5ba Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 17 Jul 2026 23:47:58 +0900 Subject: [PATCH] Compute separator length once in printInfoImpl separatorLength now derives value from window layout on each call; hoist to local as it cannot change within single repaint --- src/terminal.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index 8e4968ef..a4815472 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -3398,6 +3398,7 @@ func (t *Terminal) printInfoImpl() { } pos := 0 line := 0 + separatorLen := t.separatorLength() maxHeight := t.window.Height() move := func(y int, x int, clear bool) bool { if y < 0 || y >= maxHeight { @@ -3425,7 +3426,7 @@ func (t *Terminal) printInfoImpl() { str = string(trimmed) width = maxWidth } - move(line, pos, t.separatorLength() == 0) + move(line, pos, separatorLen == 0) if t.reading { t.window.CPrint(tui.ColSpinner, str) } else { @@ -3434,7 +3435,7 @@ func (t *Terminal) printInfoImpl() { pos += width } printSeparator := func(fillLength int, pad bool) { - if t.separatorLength() > 0 { + if separatorLen > 0 { t.separator(t.window, fillLength) t.window.Print(" ") } else if pad { @@ -3443,7 +3444,7 @@ func (t *Terminal) printInfoImpl() { } if t.infoStyle == infoHidden { - if t.separatorLength() > 0 { + if separatorLen > 0 { if !move(line+1, 0, false) { return } @@ -3506,7 +3507,7 @@ func (t *Terminal) printInfoImpl() { } switch t.infoStyle { case infoDefault: - if !move(line+1, 0, t.separatorLength() == 0) { + if !move(line+1, 0, separatorLen == 0) { return } printSpinner() @@ -3590,7 +3591,7 @@ func (t *Terminal) printInfoImpl() { } if t.infoStyle == infoInlineRight { - if t.separatorLength() > 0 { + if separatorLen > 0 { if !move(line+1, 0, false) { return }