A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/edi/st.rs')
| -rw-r--r-- | src/edi/st.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/edi/st.rs b/src/edi/st.rs index e68da23..d7e60ff 100644 --- a/src/edi/st.rs +++ b/src/edi/st.rs @@ -7,8 +7,10 @@ use regex::Regex; use winit::event::MouseButton; use winit::keyboard::{Key, NamedKey, SmolStr}; -use crate::lsp::{AQErr, Rq, RqS}; -use crate::sym::{Symbols, SymbolsList}; +use crate::commands::Commands; +use crate::edi::handle2; +use crate::lsp::{AQErr, RequestError, Rq, RqS}; +use crate::sym::{Symbols, SymbolsType}; use crate::text::TextArea; use crate::{ BoolRequest, CLICKING, InputRequest, act, alt, ctrl, handle, shift, @@ -34,13 +36,35 @@ rust_fsm::state_machine! { pub(crate) State => #[derive(Debug)] pub(crate) Action => #[derive(Debug)] pub(crate) Do Dead => K(Key => _) => Dead, +Normal => { + K(Key::Character(x) if x == "i") => Insert, + K(Key::Character(x) if x == ":") => Command (Commands => default()), K(Key::Named(Space)) => SpaceMode ( SpaceModes => default() ), + K(_) => _, + M(_) => _, + C(_) => _, +}, +Insert => { + K(Key::Named(Escape)) => Normal, + K(k) => _ [Edit], + K(_) => _, + M(_) => _, + C(_) => _, +}, +Command(_) => K(Key::Named(Escape)) => Normal, +Command(t) => K(Key::Named(Enter)) => Normal [ProcessCommand(Commands => t)], +Command(t) => K(Key::Named(Tab) if shift()) => _ [CommandPrev], +Command(t) => K(Key::Named(Tab)) => _ [CommandNext], +Command(mut t) => K(k) => Command({ handle2(&k, &mut t.tedit, None); t }), +Command(t) => C(_) => _, +Command(t) => K(_) => _, SpaceMode(_) => K(Key::Named(Escape)) => Normal, SpaceMode(t) => C(_) => _, SpaceMode(t) => K(_) => _, Default => { + K(Key::Character(x) if x == "n" && ctrl()) => Normal, K(Key::Character(x) if x == "s" && ctrl()) => Save [Save], K(Key::Character(x) if x == "q" && ctrl()) => Dead [Quit], K(Key::Character(x) if x == "v" && ctrl()) => _ [Paste], |