vtcode_tui/core_tui/session/
driver.rs1use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
2
3use crate::core_tui::log::LogEntry;
4use crate::core_tui::runner::TuiSessionDriver;
5use crate::core_tui::types::{InlineCommand, InlineEvent};
6use crate::options::FullscreenInteractionSettings;
7
8use super::Session;
9
10impl TuiSessionDriver for Session {
11 type Command = InlineCommand;
12 type Event = InlineEvent;
13
14 fn handle_command(&mut self, command: Self::Command) {
15 self.handle_command(command);
16 }
17
18 fn handle_event(
19 &mut self,
20 event: crossterm::event::Event,
21 events: &UnboundedSender<Self::Event>,
22 callback: Option<&(dyn Fn(&Self::Event) + Send + Sync + 'static)>,
23 ) {
24 self.handle_event(event, events, callback);
25 }
26
27 fn handle_tick(&mut self) {
28 self.handle_tick();
29 }
30
31 fn render(&mut self, frame: &mut ratatui::Frame<'_>) {
32 self.render(frame);
33 }
34
35 fn take_redraw(&mut self) -> bool {
36 self.take_redraw()
37 }
38
39 fn use_steady_cursor(&self) -> bool {
40 self.use_steady_cursor()
41 }
42
43 fn is_hovering_link(&self) -> bool {
44 self.is_hovering_link()
45 }
46
47 fn is_selecting_text(&self) -> bool {
48 self.is_selecting_text()
49 }
50
51 fn should_exit(&self) -> bool {
52 self.should_exit()
53 }
54
55 fn request_exit(&mut self) {
56 self.request_exit();
57 }
58
59 fn mark_dirty(&mut self) {
60 self.mark_dirty();
61 }
62
63 fn update_terminal_title(&mut self) {
64 self.update_terminal_title();
65 }
66
67 fn clear_terminal_title(&mut self) {
68 self.clear_terminal_title();
69 }
70
71 fn is_running_activity(&self) -> bool {
72 self.is_running_activity()
73 }
74
75 fn has_status_spinner(&self) -> bool {
76 self.has_status_spinner()
77 }
78
79 fn thinking_spinner_active(&self) -> bool {
80 self.thinking_spinner.is_active
81 }
82
83 fn has_active_navigation_ui(&self) -> bool {
84 self.has_active_overlay()
85 }
86
87 fn apply_coalesced_scroll(&mut self, line_delta: i32, page_delta: i32) {
88 self.apply_coalesced_scroll(line_delta, page_delta);
89 }
90
91 fn set_show_logs(&mut self, show: bool) {
92 self.show_logs = show;
93 }
94
95 fn set_active_pty_sessions(
96 &mut self,
97 sessions: Option<std::sync::Arc<std::sync::atomic::AtomicUsize>>,
98 ) {
99 self.active_pty_sessions = sessions;
100 }
101
102 fn set_workspace_root(&mut self, root: Option<std::path::PathBuf>) {
103 self.set_workspace_root(root);
104 }
105
106 fn set_log_receiver(&mut self, receiver: UnboundedReceiver<LogEntry>) {
107 self.set_log_receiver(receiver);
108 }
109
110 fn set_fullscreen_active(&mut self, active: bool) {
111 self.set_fullscreen_active(active);
112 }
113
114 fn set_fullscreen_interaction(&mut self, config: FullscreenInteractionSettings) {
115 self.set_fullscreen_interaction(config);
116 }
117}