This update replaces the previous ratatui history widget with an append-only log so that the terminal can handle text selection and scrolling. It also disables streaming responses, which we'll do our best to bring back in a later PR. It also adds a small summary of token use after the TUI exits.
40 lines
989 B
Rust
40 lines
989 B
Rust
use ratatui::buffer::Buffer;
|
|
use ratatui::widgets::WidgetRef;
|
|
|
|
use crate::app_event_sender::AppEventSender;
|
|
use crate::status_indicator_widget::StatusIndicatorWidget;
|
|
|
|
use super::BottomPaneView;
|
|
use super::bottom_pane_view::ConditionalUpdate;
|
|
|
|
pub(crate) struct StatusIndicatorView {
|
|
view: StatusIndicatorWidget,
|
|
}
|
|
|
|
impl StatusIndicatorView {
|
|
pub fn new(app_event_tx: AppEventSender) -> Self {
|
|
Self {
|
|
view: StatusIndicatorWidget::new(app_event_tx),
|
|
}
|
|
}
|
|
|
|
pub fn update_text(&mut self, text: String) {
|
|
self.view.update_text(text);
|
|
}
|
|
}
|
|
|
|
impl BottomPaneView<'_> for StatusIndicatorView {
|
|
fn update_status_text(&mut self, text: String) -> ConditionalUpdate {
|
|
self.update_text(text);
|
|
ConditionalUpdate::NeedsRedraw
|
|
}
|
|
|
|
fn should_hide_when_task_is_done(&mut self) -> bool {
|
|
true
|
|
}
|
|
|
|
fn render(&self, area: ratatui::layout::Rect, buf: &mut Buffer) {
|
|
self.view.render_ref(area, buf);
|
|
}
|
|
}
|