diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index aacdb56..e270acf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -165,6 +165,16 @@ impl Session { self.line.del_right(); self.line.display_post(b" "); } + + fn move_to_begin(&mut self) { + cursor::move_cursor(Direction::Left, self.line.all_left()); + io::stdout().flush().unwrap(); + } + + fn move_to_end(&mut self) { + cursor::move_cursor(Direction::Right, self.line.all_right()); + io::stdout().flush().unwrap(); + } } fn read1() -> u8 { @@ -203,10 +213,23 @@ fn event_loop() { }; match buf[0] { + // Ctrl+A + 1 => { + se.move_to_begin(); + continue; + } + + // Ctrl+E + 5 => { + se.move_to_end(); + continue; + } + // Ctrl+C 3 => { se.clear_prompt(); se.history_visit = 0; + continue; } // EOF |
