fix(tui): surface late clarifications and stop bg bleed on input + action rows

- clarDismissed was model-global but only reset when the clarification's
  session was selected on arrival, so a clarification for an unselected
  session stayed silently hidden. Reset on every arrival.
- input bar (in-session + launcher) only truncated lines, never padded to
  width, so the terminal backdrop bled through the right. Pad with padTo.
- action/narration/user rows prefixed plain (unstyled) spacers around their
  icons, leaving transparent gaps near the symbols. Use bg-styled spacers.
This commit is contained in:
2026-07-03 01:00:55 +04:00
parent 5e98f6661e
commit 527490e5df
2 changed files with 12 additions and 6 deletions
+4
View File
@@ -544,6 +544,10 @@ func (m *Model) onClarificationRequired(msg protocol.ServerMessage) {
if s := m.session(msg.SessionID); s != nil { if s := m.session(msg.SessionID); s != nil {
s.Clar = c s.Clar = c
} }
// A newly-arrived clarification must always surface. clarDismissed is model-global, and
// clarInitState (which clears it) only runs for the selected session — so a clarification
// arriving for an unselected session while the flag was left set would stay silently hidden.
m.clarDismissed = false
if msg.SessionID == m.selectedID { if msg.SessionID == m.selectedID {
m.clarInitState(len(qs)) m.clarInitState(len(qs))
} }
+8 -6
View File
@@ -564,7 +564,7 @@ func (m Model) launcherInput(w int) string {
rule := lipgloss.NewStyle().Foreground(ruleColor).Background(t.P.Bg).Render(strings.Repeat("─", w)) rule := lipgloss.NewStyle().Foreground(ruleColor).Background(t.P.Bg).Render(strings.Repeat("─", w))
boxLines := append([]string{rule}, content...) boxLines := append([]string{rule}, content...)
for i, ln := range boxLines { for i, ln := range boxLines {
boxLines[i] = ansi.Truncate(ln, w, "") boxLines[i] = padTo(ln, w, t.P.Bg)
} }
box := strings.Join(boxLines, "\n") box := strings.Join(boxLines, "\n")
@@ -713,8 +713,10 @@ func (m Model) renderInput() string {
rule := lipgloss.NewStyle().Foreground(ruleColor).Background(t.P.Bg).Render(strings.Repeat("─", m.width)) rule := lipgloss.NewStyle().Foreground(ruleColor).Background(t.P.Bg).Render(strings.Repeat("─", m.width))
lines := append([]string{rule}, content...) lines := append([]string{rule}, content...)
lines = append(lines, sub) lines = append(lines, sub)
// Pad (not just truncate) every line to full width with the panel bg so the terminal backdrop
// can't bleed through the right of the placeholder / status sub-line (matches the frame fill).
for i, ln := range lines { for i, ln := range lines {
lines[i] = ansi.Truncate(ln, m.width, "") lines[i] = padTo(ln, m.width, t.P.Bg)
} }
return strings.Join(lines, "\n") return strings.Join(lines, "\n")
} }
@@ -797,7 +799,7 @@ func (m Model) buildTranscriptRows(w int) ([]string, []int) {
break break
} }
tag := lipgloss.NewStyle().Foreground(t.P.Accent).Background(t.P.Bg).Bold(true).Render("") tag := lipgloss.NewStyle().Foreground(t.P.Accent).Background(t.P.Bg).Bold(true).Render("")
rows = append(rows, tag+" "+t.span(e.Content, t.P.FgStrong)) rows = append(rows, tag+t.span(" ", t.P.Bg)+t.span(e.Content, t.P.FgStrong))
case "router": case "router":
// The router turn is model output: render it as markdown (bold, // The router turn is model output: render it as markdown (bold,
// lists, headings, code) wrapped to the panel width. glamour applies // lists, headings, code) wrapped to the panel width. glamour applies
@@ -818,9 +820,9 @@ func (m Model) buildTranscriptRows(w int) ([]string, []int) {
lines := wrap(e.Content, w-2) lines := wrap(e.Content, w-2)
for i, ln := range lines { for i, ln := range lines {
if i == 0 { if i == 0 {
rows = append(rows, diamond+" "+t.span(ln, t.P.FgStrong)) rows = append(rows, diamond+t.span(" ", t.P.Bg)+t.span(ln, t.P.FgStrong))
} else { } else {
rows = append(rows, " "+t.span(ln, t.P.FgStrong)) rows = append(rows, t.span(" ", t.P.Bg)+t.span(ln, t.P.FgStrong))
} }
} }
if s := metricsSuffix(e.Metrics); s != "" { if s := metricsSuffix(e.Metrics); s != "" {
@@ -835,7 +837,7 @@ func (m Model) buildTranscriptRows(w int) ([]string, []int) {
break break
} }
icon := lipgloss.NewStyle().Foreground(t.P.Accent2).Background(t.P.Bg).Render(e.Icon) icon := lipgloss.NewStyle().Foreground(t.P.Accent2).Background(t.P.Bg).Render(e.Icon)
rows = append(rows, " "+icon+" "+t.span(e.Content, t.P.Dim)) rows = append(rows, t.span(" ", t.P.Bg)+icon+t.span(" ", t.P.Bg)+t.span(e.Content, t.P.Dim))
} }
} }
return rows, msgStart return rows, msgStart