redo
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 43s
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 43s
Undo / Redo are currently bound to Pageup/down. This is ideally temporary, I just need to figure out ctrl+r for redo. "u" is also bound to undo as it should be
This commit is contained in:
@@ -419,13 +419,23 @@ impl App {
|
|||||||
},
|
},
|
||||||
Mode::Normal => match event::read()? {
|
Mode::Normal => match event::read()? {
|
||||||
event::Event::Key(key_event) => match key_event.code {
|
event::Event::Key(key_event) => match key_event.code {
|
||||||
event::KeyCode::F(_) => {},
|
event::KeyCode::F(n) => {},
|
||||||
event::KeyCode::Char(c) => Mode::process_key(self, c),
|
event::KeyCode::Char(c) => Mode::process_key(self, c),
|
||||||
|
// Pretend that the arrow keys are vim movement keys
|
||||||
event::KeyCode::Left => Mode::process_key(self, 'h'),
|
event::KeyCode::Left => Mode::process_key(self, 'h'),
|
||||||
event::KeyCode::Right => Mode::process_key(self, 'l'),
|
event::KeyCode::Right => Mode::process_key(self, 'l'),
|
||||||
event::KeyCode::Up => Mode::process_key(self, 'k'),
|
event::KeyCode::Up => Mode::process_key(self, 'k'),
|
||||||
event::KeyCode::Down => Mode::process_key(self, 'j'),
|
event::KeyCode::Down => Mode::process_key(self, 'j'),
|
||||||
event::KeyCode::Modifier(modifier_key_code) => todo!(),
|
// Getting ctrl to work isn't going will right now. Use page keys for the time being.
|
||||||
|
event::KeyCode::PageUp => self.grid.redo(),
|
||||||
|
event::KeyCode::PageDown => self.grid.undo(),
|
||||||
|
event::KeyCode::Modifier(modifier_key_code) => {
|
||||||
|
if let event::ModifierKeyCode::LeftControl | event::ModifierKeyCode::RightControl = modifier_key_code {
|
||||||
|
// TODO my terminal (alacritty) isn't showing me ctrl presses. I know
|
||||||
|
// that they work tho, since ctrl+r works here in neovim.
|
||||||
|
// panic!("heard ctrl");
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ impl Grid {
|
|||||||
self.current_grid = self.current_grid.saturating_sub(1);
|
self.current_grid = self.current_grid.saturating_sub(1);
|
||||||
}
|
}
|
||||||
pub fn redo(&mut self) {
|
pub fn redo(&mut self) {
|
||||||
self.current_grid += 1;
|
self.current_grid = min(self.grid_history.len() - 1, self.current_grid + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transact_on_grid<F>(&mut self, mut action: F)
|
pub fn transact_on_grid<F>(&mut self, mut action: F)
|
||||||
|
|||||||
Reference in New Issue
Block a user