diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2024-01-06 23:45:07 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2024-01-06 23:45:07 -0800 |
| commit | 01510eeccff4f5062ec061a964176d3a800a7094 (patch) | |
| tree | 4e5afb44b90a5a72013a30191af67a25b123cf42 /src/term.rs | |
| parent | Use a b-tree for the rope. (diff) | |
| download | editor-01510eeccff4f5062ec061a964176d3a800a7094.tar.zst | |
Implement undo.
Diffstat (limited to 'src/term.rs')
| -rw-r--r-- | src/term.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/term.rs b/src/term.rs index 9c7e2cc..3a56091 100644 --- a/src/term.rs +++ b/src/term.rs @@ -68,6 +68,7 @@ pub fn raw() -> Result<RawHandle, Box<dyn Error>> { pub enum Key { CtrlQ, CtrlS, + CtrlZ, Up, Down, Left, @@ -79,6 +80,7 @@ pub enum Key { pub fn read_key() -> Result<Key, Box<dyn Error>> { const CTRL_Q: u8 = 17; const CTRL_S: u8 = 19; + const CTRL_Z: u8 = 26; const BACKSPACE: u8 = 127; const ESC: u8 = 27; @@ -91,6 +93,9 @@ pub fn read_key() -> Result<Key, Box<dyn Error>> { if buf[0] == CTRL_S { return Ok(Key::CtrlS); } + if buf[0] == CTRL_Z { + return Ok(Key::CtrlZ); + } if buf[0] == BACKSPACE { return Ok(Key::Backspace); } |
