Skip to content

Commit 2748556

Browse files
committed
fix(tui): ● marker only once per response, not per delta chunk
1 parent dd0daf5 commit 2748556

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

β€Žcrates/tui/src/app.rsβ€Ž

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ pub struct App {
165165
last_interrupt: Option<Instant>,
166166
/// Current permission mode (cycled via Shift+Tab).
167167
pub permission_mode: crab_core::permission::PermissionMode,
168+
/// Whether the ● response marker has been added for the current turn.
169+
response_started: bool,
168170
}
169171

170172
impl App {
@@ -201,6 +203,7 @@ impl App {
201203
input_mode: PromptInputMode::Prompt,
202204
last_interrupt: None,
203205
permission_mode: crab_core::permission::PermissionMode::Default,
206+
response_started: false,
204207
}
205208
}
206209

@@ -507,6 +510,7 @@ impl App {
507510
// Show user prompt in content area (no divider β€” CC doesn't have one)
508511
let _ = writeln!(self.content_buffer, "\n❯ {text}\n");
509512
self.state = AppState::Processing;
513+
self.response_started = false;
510514
self.spinner.start_with_random_verb();
511515
return AppAction::Submit(text);
512516
}
@@ -583,9 +587,13 @@ impl App {
583587
use crab_core::event::Event;
584588
match event {
585589
Event::ContentDelta { delta, .. } => {
586-
// Add ● marker at the start of assistant response (CC style)
587-
if self.state == AppState::Processing && !self.content_buffer.ends_with("● ") {
590+
// Add ● marker once at the start of a new assistant response.
591+
// The marker is added when transitioning from "just submitted" to
592+
// "first content arriving". We detect this by checking if the last
593+
// non-whitespace content ends with the user prompt echo line.
594+
if !self.response_started {
588595
self.content_buffer.push_str("● ");
596+
self.response_started = true;
589597
}
590598
// Track unseen content when the user is scrolled up
591599
if self.scroll_anchor.is_some() {

0 commit comments

Comments
Β (0)