refactor(editor): simplify key matching further

This commit is contained in:
Harsh Shandilya 2022-08-11 15:19:25 +05:30
parent d203222447
commit e05920338c
No known key found for this signature in database

View File

@ -118,16 +118,19 @@ impl Editor {
self.document.delete(&self.cursor_position);
}
}
(KeyCode::Left, KeyModifiers::NONE)
| (KeyCode::Right, KeyModifiers::NONE)
| (KeyCode::Up, KeyModifiers::NONE)
| (KeyCode::Down, KeyModifiers::NONE)
| (KeyCode::PageUp, KeyModifiers::NONE)
| (KeyCode::PageDown, KeyModifiers::NONE)
| (KeyCode::Home, KeyModifiers::NONE)
| (KeyCode::End, KeyModifiers::NONE) => self.move_cursor(code),
(
KeyCode::Left
| KeyCode::Right
| KeyCode::Up
| KeyCode::Down
| KeyCode::PageUp
| KeyCode::PageDown
| KeyCode::Home
| KeyCode::End,
KeyModifiers::NONE,
) => self.move_cursor(code),
_ => (),
}
};
self.scroll();
Ok(())
}