Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct AppState {
pub ai_response: String,
pub terminal_context: Arc<Mutex<String>>,
pub user_chat_to_send_to_gpt: String,
pub terminal_scroll: usize, // Added to track the scroll position
}

impl AppState {
Expand All @@ -25,6 +26,7 @@ impl AppState {
ai_response: "".to_string(),
tick: 0,
user_chat_to_send_to_gpt: "".to_string(),
terminal_scroll: 0, // Initialized to 0
}
}

Expand Down
11 changes: 10 additions & 1 deletion src/services/ui_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ impl UiService {
Mode::Terminal => Style::default().cyan(),
Mode::Chat => Style::default(),
};
let pseudo_terminal = PseudoTerminal::new(screen);
let pseudo_terminal = PseudoTerminal::new(screen)
.scroll((self.app_state.terminal_scroll, 0)); // Added scroll functionality based on AppState::terminal_scroll
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no .scroll function on the PsuedoTerminal Widget

frame.render_widget(
pseudo_terminal.block(
Block::default()
Expand Down Expand Up @@ -139,6 +140,14 @@ impl UiService {
"tell me a two paragraph story".to_string(),
))
.unwrap(),
KeyCode::Up => {
if self.app_state.terminal_scroll > 0 {
self.app_state.terminal_scroll -= 1; // Handle scroll up
}
}
KeyCode::Down => {
self.app_state.terminal_scroll += 1; // Handle scroll down
}
_ => {}
},
_ => {}
Expand Down