fix(tui/history): dim mid-turn assistant output

This commit is contained in:
James Peter
2025-12-12 17:58:41 +10:00
parent c03b3e9646
commit b688046f98
2 changed files with 30 additions and 4 deletions
+14
View File
@@ -285,6 +285,20 @@ pub(crate) fn assistant_bg() -> Color {
}
}
/// Background for mid-turn assistant messages.
///
/// Uses a lighter tint than `assistant_bg` so progress inserts feel secondary.
pub(crate) fn assistant_mid_turn_bg() -> Color {
match palette_mode() {
PaletteMode::Ansi16 => assistant_bg(),
PaletteMode::Ansi256 => {
let bg = current_theme().background;
let info = current_theme().info;
mix_toward(bg, info, 0.02)
}
}
}
/// Background for multiline code blocks rendered in assistant markdown.
///
/// New behavior: match the assistant message background so code cards feel
+16 -4
View File
@@ -101,7 +101,11 @@ impl AssistantMarkdownCell {
buf: &mut Buffer,
skip_rows: u16,
) {
let cell_bg = crate::colors::assistant_bg();
let cell_bg = if self.state.mid_turn {
crate::colors::assistant_mid_turn_bg()
} else {
crate::colors::assistant_bg()
};
let bg_style = Style::default().bg(cell_bg);
fill_rect(buf, area, Some(' '), bg_style);
@@ -173,7 +177,11 @@ impl AssistantMarkdownCell {
let temp_area = Rect::new(0, 0, card_w, full_height);
let mut temp_buf = Buffer::empty(temp_area);
let code_bg = crate::colors::code_block_bg();
let code_bg = if self.state.mid_turn {
cell_bg
} else {
crate::colors::code_block_bg()
};
let blk = Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(crate::colors::border()))
@@ -323,9 +331,13 @@ pub(crate) fn assistant_markdown_lines_with_context(
cwd,
!state.mid_turn,
);
let bright = crate::colors::text_bright();
let fg = if state.mid_turn {
crate::colors::text_mid()
} else {
crate::colors::text_bright()
};
for line in out.iter_mut().skip(1) {
line.style = line.style.patch(Style::default().fg(bright));
line.style = line.style.patch(Style::default().fg(fg));
}
out.into_iter().skip(1).collect()
}