Skip to content

Commit 9d9ff05

Browse files
committed
fix: update agent status to Orchestrating and adjust navigation flow in app
1 parent 1b482b1 commit 9d9ff05

File tree

1 file changed

+21
-12
lines changed
  • crates/agentic-tui/src/ui

1 file changed

+21
-12
lines changed

crates/agentic-tui/src/ui/app.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ impl App {
618618
self.proposals = proposals;
619619
self.current_proposal_index = 0;
620620
self.mode = AppMode::Orchestrating;
621-
self.agent_status = AgentStatus::Ready;
621+
self.agent_status = AgentStatus::Orchestrating; // Keep Orchestrating status to show token count
622622
}
623623
AgentMessage::ProposalsGenerated(Err(_e)) => {
624624
self.coaching_tip = (
@@ -922,7 +922,7 @@ impl App {
922922
KeyCode::Up => {
923923
// Save synthesis (positive action)
924924
self.save_synthesis();
925-
self.mode = AppMode::Normal;
925+
self.mode = AppMode::Chat; // Go directly to chat for next query
926926
self.final_prompt.clear();
927927
self.proposals.clear();
928928
self.current_proposal_index = 0;
@@ -956,23 +956,32 @@ impl App {
956956
KeyCode::Right => {
957957
// Scroll down through synthesis content with bounds checking
958958
if let Some(note) = &self.cloud_response {
959-
// Calculate content height (number of lines when wrapped)
960-
let content_width = 60; // Approximate usable width after borders
959+
// Conservative approach: assume reasonable display size
960+
// Most terminals will have synthesis width around 50-70 chars
961+
let approx_usable_width = 50u16; // Conservative estimate
962+
let approx_display_height = 10u16; // Conservative estimate (12 - 2 for borders)
963+
964+
// Calculate total lines needed when text wraps
961965
let lines: Vec<&str> = note.body_text.lines().collect();
962-
let total_wrapped_lines = lines
966+
let total_wrapped_lines: u16 = lines
963967
.iter()
964968
.map(|line| {
965-
((line.len() as f32 / content_width as f32).ceil()
966-
as u16)
967-
.max(1)
969+
if line.is_empty() {
970+
1 // Empty lines still take space
971+
} else {
972+
((line.len() as f32 / approx_usable_width as f32)
973+
.ceil()
974+
as u16)
975+
.max(1)
976+
}
968977
})
969-
.sum::<u16>();
978+
.sum();
970979

971-
let display_height = 10; // Approximate usable height (12 - 2 for borders)
980+
// Only allow scrolling if content exceeds display height
972981
let max_scroll =
973-
total_wrapped_lines.saturating_sub(display_height);
982+
total_wrapped_lines.saturating_sub(approx_display_height);
974983

975-
if self.synthesis_scroll < max_scroll {
984+
if max_scroll > 0 && self.synthesis_scroll < max_scroll {
976985
self.synthesis_scroll += 1;
977986
}
978987
}

0 commit comments

Comments
 (0)