feat: stabilize list output with fixed-height preview (5 lines, 300 chars)
Each session always occupies the same number of lines, preventing visual jitter between watch refreshes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
display.go
10
display.go
@@ -92,10 +92,12 @@ func DisplaySessionInfos(w io.Writer, sessions []SessionInfo, noColor bool, now
|
||||
|
||||
fmt.Fprintf(w, "[%s] %s%s%s%s%s\n", stateStr, s.Cwd, branch, workspace, label, waiting)
|
||||
|
||||
if s.Preview != "" {
|
||||
lines := strings.Split(s.Preview, "\n")
|
||||
for _, line := range lines {
|
||||
fmt.Fprintf(w, " %s\n", line)
|
||||
lines := strings.Split(s.Preview, "\n")
|
||||
for i := 0; i < previewLines; i++ {
|
||||
if i < len(lines) && lines[i] != "" {
|
||||
fmt.Fprintf(w, " %s\n", lines[i])
|
||||
} else {
|
||||
fmt.Fprintln(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user