vtcode_ui/tui/core_tui/session/
driver.rs1use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
2
3use crate::tui::core_tui::log::LogEntry;
4use crate::tui::core_tui::runner::TuiSessionDriver;
5use crate::tui::core_tui::types::{InlineCommand, InlineEvent};
6use crate::tui::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 needs_animation_tick(&self) -> bool {
32 self.needs_animation_tick()
33 }
34
35 fn render(&mut self, frame: &mut ratatui::Frame<'_>) {
36 self.render(frame);
37 }
38
39 fn take_redraw(&mut self) -> bool {
40 self.take_redraw()
41 }
42
43 fn use_steady_cursor(&self) -> bool {
44 self.use_steady_cursor()
45 }
46
47 fn is_hovering_link(&self) -> bool {
48 self.is_hovering_link()
49 }
50
51 fn is_selecting_text(&self) -> bool {
52 self.is_selecting_text()
53 }
54
55 fn should_exit(&self) -> bool {
56 self.should_exit()
57 }
58
59 fn request_exit(&mut self) {
60 self.request_exit();
61 }
62
63 fn mark_dirty(&mut self) {
64 self.mark_dirty();
65 }
66
67 fn update_terminal_title(&mut self) {
68 self.update_terminal_title();
69 }
70
71 fn attach_program_status_terminal(&mut self) {
72 self.program_status.attach_terminal();
73 }
74
75 fn flush_program_status(&mut self) {
76 self.program_status.flush();
77 }
78
79 fn shutdown_program_status(&mut self) {
80 self.program_status.shutdown();
81 }
82
83 fn clear_terminal_title(&mut self) {
84 self.clear_terminal_title();
85 }
86
87 fn is_running_activity(&self) -> bool {
88 self.is_running_activity()
89 }
90
91 fn has_status_spinner(&self) -> bool {
92 self.has_status_spinner()
93 }
94
95 fn thinking_spinner_active(&self) -> bool {
96 self.thinking_spinner.is_active
97 }
98
99 fn has_active_navigation_ui(&self) -> bool {
100 self.has_active_overlay()
101 }
102
103 fn apply_coalesced_scroll(&mut self, line_delta: i32, page_delta: i32) {
104 self.apply_coalesced_scroll(line_delta, page_delta);
105 }
106
107 fn set_show_logs(&mut self, show: bool) {
108 self.show_logs = show;
109 }
110
111 fn set_active_pty_sessions(&mut self, sessions: Option<std::sync::Arc<std::sync::atomic::AtomicUsize>>) {
112 self.active_pty_sessions = sessions;
113 }
114
115 fn set_workspace_root(&mut self, root: Option<std::path::PathBuf>) {
116 self.set_workspace_root(root);
117 }
118
119 fn set_log_receiver(&mut self, receiver: UnboundedReceiver<LogEntry>) {
120 self.set_log_receiver(receiver);
121 }
122
123 fn set_fullscreen_active(&mut self, active: bool) {
124 self.set_fullscreen_active(active);
125 }
126
127 fn set_fullscreen_interaction(&mut self, config: FullscreenInteractionSettings) {
128 self.set_fullscreen_interaction(config);
129 }
130
131 fn set_preview_callback(&mut self, _callback: Option<crate::tui::core_tui::types::PreviewCallback>) {
132 }
134}