aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-ai/src/tui/components/atuin_ai.rs
diff options
context:
space:
mode:
authorMichelle Tilley <michelle@michelletilley.net>2026-03-27 10:45:04 -0700
committerGitHub <noreply@github.com>2026-03-27 10:45:04 -0700
commitbc9e62e8e24f5e218acd471404455ef57bc7d752 (patch)
treeac647dcadac9c1ddf3b0ec3e21e5e3bd9bb33993 /crates/atuin-ai/src/tui/components/atuin_ai.rs
parentfeat: Use eye-declare for more performant and flexible AI TUI (#3343) (diff)
downloadatuin-bc9e62e8e24f5e218acd471404455ef57bc7d752.zip
chore(deps): Update to eye-declare v0.2.0 (#3355)
eye-declare v0.2.0 includes two relevant changes: * "Capture-phase" event handling lets us remove the special-case event handling in `InputBox` that allowed global keyboard binds to work; the `AtuinAi` component now handles this directly. * `Tracked::read()` allows reading fields in tracked state without triggering the dirty-tracking from the `DerefMut` implementation, allowing us to send messages on the app event bus without marking the containing state as dirty.
Diffstat (limited to 'crates/atuin-ai/src/tui/components/atuin_ai.rs')
-rw-r--r--crates/atuin-ai/src/tui/components/atuin_ai.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/atuin-ai/src/tui/components/atuin_ai.rs b/crates/atuin-ai/src/tui/components/atuin_ai.rs
index 680b93ed..b2239a70 100644
--- a/crates/atuin-ai/src/tui/components/atuin_ai.rs
+++ b/crates/atuin-ai/src/tui/components/atuin_ai.rs
@@ -7,7 +7,7 @@
use std::sync::mpsc;
use crossterm::event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
-use eye_declare::{Component, EventResult, Hooks, impl_slot_children};
+use eye_declare::{Component, EventResult, Hooks, Tracked, impl_slot_children};
use crate::tui::events::AiTuiEvent;
use crate::tui::state::AppMode;
@@ -67,7 +67,9 @@ impl Component for AtuinAi {
0
}
- fn handle_event(&self, event: &Event, state: &mut Self::State) -> EventResult {
+ fn handle_event_capture(&self, event: &Event, state: &mut Tracked<Self::State>) -> EventResult {
+ let state = state.read();
+
let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,