From 999964abdede38ecde147bb027d8d5c13aebd5f2 Mon Sep 17 00:00:00 2001 From: alice pellerin Date: Tue, 17 Mar 2026 04:49:47 -0500 Subject: [PATCH] sketch out zz, plan other modes --- src/app/mod.rs | 14 ++++++++++++-- src/main.rs | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index e6092ba..9943ef1 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -26,7 +26,7 @@ pub enum Mode { #[derive(Debug)] pub enum PartialAction { - Goto, Zview + Goto, Zview, Replace } impl Mode { @@ -52,6 +52,7 @@ impl PartialAction { match self { Self::Goto => "g", Self::Zview => "z", + Self::Replace => "r", } } } @@ -193,6 +194,16 @@ impl App { self.clamp_screen_to_cursor(); } + (Mode::Normal, Event::Key(key_event), None) + if key_event.code == KeyCode::Char('z') => { + self.partial_action = Some(PartialAction::Zview); + } + + (Mode::Normal, Event::Key(key_event), Some(PartialAction::Zview)) + if key_event.code == KeyCode::Char('z') => { + self.partial_action = None; + } + (Mode::Normal, Event::Key(key_event), None) if key_event.code == KeyCode::Char('i') || key_event.code == KeyCode::Up => { @@ -278,7 +289,6 @@ impl App { } (Mode::Normal, Event::Key(_), Some(_)) => { - self.logs.push("key press!".to_string()); self.partial_action = None; } diff --git a/src/main.rs b/src/main.rs index 2b9bc39..35eb359 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,13 +15,18 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK; // TODO: // - modes -// - g/v/z +// - select +// - insert +// - zz/zt/zb // - search // - jumplist // - modifications // - insert/append +// - mode // - replace +// - partial action // - replace-and-keep-going +// - mode // - delete // - change