Skip to content

Commit 0f4e78b

Browse files
committed
Merge main into feature branch
2 parents b8aa96d + 54fda05 commit 0f4e78b

3 files changed

Lines changed: 16 additions & 35 deletions

File tree

src/app.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ enum Action {
164164
// Tool approval
165165
ApproveTool,
166166
DenyTool,
167-
ApproveToolSession,
168167
}
169168

170169
/// Map a terminal event to an action based on the current input mode
@@ -236,7 +235,6 @@ fn map_key_tool_approval(key: KeyEvent) -> Option<Action> {
236235
match key.code {
237236
KeyCode::Char('y') | KeyCode::Enter => Some(Action::ApproveTool),
238237
KeyCode::Char('n') | KeyCode::Esc => Some(Action::DenyTool),
239-
KeyCode::Char('a') => Some(Action::ApproveToolSession),
240238
_ => None,
241239
}
242240
}
@@ -548,10 +546,6 @@ impl App {
548546
Action::DenyTool => {
549547
self.decide_pending_tool(ToolDecision::Deny).await;
550548
},
551-
Action::ApproveToolSession => {
552-
// TODO: implement allow for session
553-
self.decide_pending_tool(ToolDecision::Approve).await;
554-
},
555549
Action::InsertChar(c) => self.input.insert_char(c),
556550
Action::InsertNewline => self.input.insert_newline(),
557551
Action::DeleteBack => self.input.delete_char(),

src/transcript.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,7 @@ pub fn render_approval_prompt() -> Line<'static> {
331331
.fg(Color::Red)
332332
.add_modifier(Modifier::BOLD),
333333
),
334-
Span::styled("]o [", Style::default().fg(Color::DarkGray)),
335-
Span::styled(
336-
"a",
337-
Style::default()
338-
.fg(Color::Cyan)
339-
.add_modifier(Modifier::BOLD),
340-
),
341-
Span::styled("]lways", Style::default().fg(Color::DarkGray)),
334+
Span::styled("]o", Style::default().fg(Color::DarkGray)),
342335
])
343336
}
344337

src/ui/chat.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
// Frozen Turns
1515
// one that has already passed into scrollback
1616

17-
use std::collections::{HashSet, HashMap, VecDeque};
17+
use std::collections::{HashMap, HashSet, VecDeque};
1818
use std::io::Stdout;
1919

2020
use chrono::Local;
21-
use ratatui:{
21+
use ratatui::{
2222
backend::CrosstermBackend,
2323
buffer::Buffer,
2424
layout::Rect,
@@ -30,7 +30,7 @@ use ratatui:{
3030

3131
#[cfg(feature = "profiling")]
3232
use crate::profile_span;
33-
use crate::transcript::{Role, Status, Transcript, Turn, Block};
33+
use crate::transcript::{Block, Role, Status, Transcript, Turn};
3434

3535
/// Chat view with native scrollback support.
3636
///
@@ -81,20 +81,13 @@ impl ChatView {
8181
// ==================== Transcript mutation + render ====================
8282

8383
/// Begin a new turn and render
84-
pub fn begin_turn(
85-
&mut self,
86-
role: Role,
87-
terminal: &mut Terminal<CrosstermBackend<Stdout>>,
88-
) {
84+
pub fn begin_turn(&mut self, role: Role, terminal: &mut Terminal<CrosstermBackend<Stdout>>) {
8985
self.transcript.begin_turn(role);
9086
self.render(terminal)
9187
}
9288

9389
/// Finish the current turn and render
94-
pub fn finish_turn(
95-
&mut self,
96-
terminal: &mut Terminal<CrosstermBackend<Stdout>>,
97-
) {
90+
pub fn finish_turn(&mut self, terminal: &mut Terminal<CrosstermBackend<Stdout>>) {
9891
self.transcript.finish_turn();
9992
self.render(terminal)
10093
}
@@ -136,10 +129,7 @@ impl ChatView {
136129

137130
/// Render active (non-frozen) turns into the hot zone.
138131
/// Overflow lines are committed to native scrollback via `insert_before()`.
139-
pub fn render(
140-
&mut self,
141-
terminal: &mut Terminal<CrosstermBackend<Stdout>>,
142-
) {
132+
pub fn render(&mut self, terminal: &mut Terminal<CrosstermBackend<Stdout>>) {
143133
#[cfg(feature = "profiling")]
144134
let _span = profile_span!("ChatView::render");
145135

@@ -162,7 +152,9 @@ impl ChatView {
162152

163153
tracing::trace!(
164154
"render(): hot_lines={}, committed_count={}, max_lines={}",
165-
hot_lines.len(), self.committed_count, self.max_lines
155+
hot_lines.len(),
156+
self.committed_count,
157+
self.max_lines
166158
);
167159

168160
self.lines.clear();
@@ -173,10 +165,14 @@ impl ChatView {
173165
// Overflow promotes to scrollback
174166
while self.lines.len() > self.max_lines {
175167
let committed = self.lines.pop_front().unwrap();
176-
let line_preview: String = committed.spans.iter().map(|s| s.content.as_ref()).collect();
168+
let line_preview: String =
169+
committed.spans.iter().map(|s| s.content.as_ref()).collect();
177170
tracing::trace!(
178171
"Scrollback commit: line={:?}, committed_count={}, lines.len={}, max={}",
179-
line_preview, self.committed_count, self.lines.len(), self.max_lines
172+
line_preview,
173+
self.committed_count,
174+
self.lines.len(),
175+
self.max_lines
180176
);
181177

182178
if let Err(e) = terminal.insert_before(1, |buf| {
@@ -294,5 +290,3 @@ impl Widget for ChatViewWidget<'_> {
294290
Paragraph::new(visible).render(area, buf);
295291
}
296292
}
297-
298-

0 commit comments

Comments
 (0)