tui: coalesce command output; show unabridged commands in transcript (#2590)
https://github.com/user-attachments/assets/effec7c7-732a-4b61-a2ae-3cb297b6b19b
This commit is contained in:
@@ -70,17 +70,6 @@ impl StreamController {
|
||||
self.header.maybe_emit(out_lines)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ensure_single_trailing_blank(lines: &mut Lines) {
|
||||
if lines
|
||||
.last()
|
||||
.map(|l| !crate::render::line_utils::is_blank_line_trim(l))
|
||||
.unwrap_or(true)
|
||||
{
|
||||
lines.push(Line::from(""));
|
||||
}
|
||||
}
|
||||
|
||||
/// Begin an answer stream. Does not emit header yet; it is emitted on first commit.
|
||||
pub(crate) fn begin(&mut self, _sink: &impl HistorySink) {
|
||||
// Starting a new stream cancels any pending finish-from-previous-stream animation.
|
||||
@@ -138,7 +127,6 @@ impl StreamController {
|
||||
let mut lines_with_header: Lines = Vec::new();
|
||||
self.emit_header_if_needed(&mut lines_with_header);
|
||||
lines_with_header.extend(out_lines);
|
||||
Self::ensure_single_trailing_blank(&mut lines_with_header);
|
||||
sink.insert_history(lines_with_header);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ impl HeaderEmitter {
|
||||
|
||||
pub(crate) fn maybe_emit(&mut self, out_lines: &mut Vec<ratatui::text::Line<'static>>) -> bool {
|
||||
if !self.emitted_in_stream && !self.emitted_this_turn {
|
||||
// Add a leading blank line before the header for visual spacing
|
||||
out_lines.push(ratatui::text::Line::from(""));
|
||||
out_lines.push(render_header_line());
|
||||
self.emitted_in_stream = true;
|
||||
self.emitted_this_turn = true;
|
||||
|
||||
Reference in New Issue
Block a user