diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-03-25 14:28:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 14:28:08 +0100 |
commit | 18ee784e2de9ed39330237acd5bc4fe986005d9a (patch) | |
tree | f3a3f1287609a9d2c82bc11994ce061c3149df23 /zellij-tile | |
parent | 854228046e765be31d01399e9955685079db0426 (diff) |
feat(ui): add navigation with alt + arrow keys (#1264)
* feat(ui): change from non-working alt-brackets to alt-arrows
* style(fmt): rustfmt
* fix: improve parsing of `alt` combination keys
The binding of the keys can now be specified with:
- Alt: 'c'
- Alt: Up
- Alt: Down
- Alt: Left
- Alt: Right
* chore(fmt): rustfmt
Co-authored-by: a-kenji <aks.kenji@protonmail.com>
Diffstat (limited to 'zellij-tile')
-rw-r--r-- | zellij-tile/src/data.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index 24ffb8cf6..c50ef4790 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -46,14 +46,29 @@ pub enum Key { Insert, F(u8), Char(char), - Alt(char), + Alt(CharOrArrow), Ctrl(char), Null, Esc, } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CharOrArrow { + Char(char), + Direction(Direction), +} +/// The four directions (left, right, up, down). +#[derive(Eq, Clone, Copy, Debug, PartialEq, Hash, Deserialize, Serialize)] +pub enum Direction { + Left, + Right, + Up, + Down, +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] // FIXME: This should be extended to handle different button clicks (not just // left click) and the `ScrollUp` and `ScrollDown` events could probably be // merged into a single `Scroll(isize)` event. |