mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-22 22:26:54 +03:00
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>
This commit is contained in:
parent
854228046e
commit
18ee784e2d
@ -47,7 +47,7 @@ fn quicknav_full(palette: Palette) -> LinePart {
|
||||
Style::new().paint(" => open new pane. "),
|
||||
Style::new().fg(orange_color).bold().paint("Alt"),
|
||||
Style::new().paint(" + "),
|
||||
Style::new().fg(green_color).bold().paint("<[]"),
|
||||
Style::new().fg(green_color).bold().paint("<←↓↑→"),
|
||||
Style::new().paint(" or "),
|
||||
Style::new().fg(green_color).bold().paint("hjkl>"),
|
||||
Style::new().paint(" => navigate between panes. "),
|
||||
@ -70,7 +70,7 @@ fn quicknav_medium(palette: Palette) -> LinePart {
|
||||
Style::new().paint(" => new pane. "),
|
||||
Style::new().fg(orange_color).bold().paint("Alt"),
|
||||
Style::new().paint(" + "),
|
||||
Style::new().fg(green_color).bold().paint("<[]"),
|
||||
Style::new().fg(green_color).bold().paint("<←↓↑→"),
|
||||
Style::new().paint(" or "),
|
||||
Style::new().fg(green_color).bold().paint("hjkl>"),
|
||||
Style::new().paint(" => navigate. "),
|
||||
@ -91,7 +91,7 @@ fn quicknav_short(palette: Palette) -> LinePart {
|
||||
Style::new().paint(" + "),
|
||||
Style::new().fg(green_color).bold().paint("n"),
|
||||
Style::new().paint("/"),
|
||||
Style::new().fg(green_color).bold().paint("[]"),
|
||||
Style::new().fg(green_color).bold().paint("<←↓↑→"),
|
||||
Style::new().paint("/"),
|
||||
Style::new().fg(green_color).bold().paint("hjkl"),
|
||||
Style::new().paint("/"),
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1673
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 558
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 498
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 967
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1061
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1757
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1 Tab #2 Tab #3 Tab #4 Tab #5 Tab #6 Tab #7 Tab #8 Tab #9
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1344
|
||||
expression: first_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (mirrored_sessions) Tab #1 Tab #2
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: first_runner_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1523
|
||||
expression: second_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_same_pane_and_tab) Tab #1 [ ]
|
||||
┌ Pane #1 ───────────┤ FOCUSED USER: ├───────────────────┐┌ Pane #2 ──────────────┤ MY FOCUS ├───────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: second_runner_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1522
|
||||
expression: first_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_same_pane_and_tab) Tab #1 [ ]
|
||||
┌ Pane #1 ──────────────┤ MY FOCUS ├───────────────────────┐┌ Pane #2 ───────────┤ FOCUSED USER: ├───────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: first_runner_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1618
|
||||
expression: second_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_different_tabs) Tab #1 [ ] Tab #2
|
||||
┌ Pane #1 ────────────────────────────────────────────┤ MY FOCUS ├─────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: second_runner_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1617
|
||||
expression: first_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_different_tabs) Tab #1 Tab #2 [ ]
|
||||
┌ Pane #1 ────────────────────────────────────────────┤ MY FOCUS ├─────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: first_runner_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1433
|
||||
expression: second_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_same_pane_and_tab) Tab #1 [ ]
|
||||
┌ Pane #1 ─────────────────────────────────────────┤ MY FOCUS AND: ├─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: second_runner_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1432
|
||||
expression: first_runner_snapshot
|
||||
|
||||
---
|
||||
Zellij (multiple_users_in_same_pane_and_tab) Tab #1 [ ]
|
||||
┌ Pane #1 ─────────────────────────────────────────┤ MY FOCUS AND: ├─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: first_runner_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 418
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1 Tab #2
|
||||
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 764
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ───────────────────────────────────────────┐┌ Pane #2 ───────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└────────────────────────────────────────────────────┘└────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 883
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ───────────────────────────────────────┐┌ Pane #2 ───────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└────────────────────────────────────────────────┘└────────────────────────────────────────────────┘
|
||||
Ctrl + g p t n h s o q
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1154
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────── SCROLL: 1/1 ┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││line19 00000000000000000000000000000000000000000000000000█│
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 151
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1200
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
$ │$ █
|
||||
@ -26,4 +26,4 @@ $ │$ █
|
||||
│
|
||||
│
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 104
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 1804
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ ││ │
|
||||
└──────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
source: src/tests/e2e/cases.rs
|
||||
assertion_line: 702
|
||||
expression: last_snapshot
|
||||
|
||||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@ -26,4 +26,4 @@ expression: last_snapshot
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT
|
||||
Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
Tip: Alt + <n> => new pane. Alt + <←↓↑→ or hjkl> => navigate. Alt + <+-> => resize pane.
|
||||
|
@ -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.
|
||||
|
@ -29,17 +29,13 @@ keybinds:
|
||||
- action: [NewPane: ]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
key: [ Alt: 'l', Alt: Right ]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up, ]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -84,18 +80,14 @@ keybinds:
|
||||
key: [Char: '-']
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -149,18 +141,14 @@ keybinds:
|
||||
key: [Char: 'e']
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them!
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -198,18 +186,14 @@ keybinds:
|
||||
key: [Char: 'l', Right,]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them!
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -269,18 +253,14 @@ keybinds:
|
||||
key: [ Char: "\t" ]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them!
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -322,18 +302,14 @@ keybinds:
|
||||
key: [Char: 'u',]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them!
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -347,18 +323,14 @@ keybinds:
|
||||
key: [Esc,]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -372,18 +344,14 @@ keybinds:
|
||||
key: [Esc,]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -413,18 +381,14 @@ keybinds:
|
||||
key: [Char: 'd',]
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [Resize: Increase,]
|
||||
key: [ Alt: '=']
|
||||
- action: [Resize: Increase,]
|
||||
@ -484,18 +448,14 @@ keybinds:
|
||||
key: [ Char: 'k']
|
||||
- action: [NewPane: ,]
|
||||
key: [ Alt: 'n',]
|
||||
- action: [MoveFocus: Left,]
|
||||
key: [ Alt: 'h',]
|
||||
- action: [MoveFocus: Right,]
|
||||
key: [ Alt: 'l',]
|
||||
- action: [MoveFocusOrTab: Left,]
|
||||
key: [ Alt: 'h', Alt: Left]
|
||||
- action: [MoveFocusOrTab: Right,]
|
||||
key: [ Alt: 'l', Alt: Right]
|
||||
- action: [MoveFocus: Down,]
|
||||
key: [ Alt: 'j',]
|
||||
key: [ Alt: 'j', Alt: Down]
|
||||
- action: [MoveFocus: Up,]
|
||||
key: [ Alt: 'k',]
|
||||
- action: [FocusPreviousPane,]
|
||||
key: [ Alt: '[',]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Alt: ']',]
|
||||
key: [ Alt: 'k', Alt: Up]
|
||||
- action: [FocusNextPane,]
|
||||
key: [ Char: 'o']
|
||||
- action: [Resize: Increase,]
|
||||
|
@ -14,7 +14,7 @@ use crate::envs;
|
||||
use termwiz::input::{InputEvent, InputParser, KeyCode, KeyEvent, Modifiers};
|
||||
use zellij_tile::{
|
||||
data::{InputMode, Key, ModeInfo, PluginCapabilities},
|
||||
prelude::Style,
|
||||
prelude::{CharOrArrow, Direction, Style},
|
||||
};
|
||||
|
||||
/// Creates a [`ModeInfo`] struct indicating the current [`InputMode`] and its keybinds
|
||||
@ -110,20 +110,41 @@ pub fn cast_termwiz_key(event: KeyEvent, raw_bytes: &[u8]) -> Key {
|
||||
if modifiers.contains(Modifiers::CTRL) {
|
||||
Key::Ctrl(c.to_lowercase().next().unwrap_or_default())
|
||||
} else if modifiers.contains(Modifiers::ALT) {
|
||||
Key::Alt(c.to_lowercase().next().unwrap_or_default())
|
||||
Key::Alt(CharOrArrow::Char(c))
|
||||
} else {
|
||||
Key::Char(c)
|
||||
}
|
||||
}
|
||||
KeyCode::Backspace => Key::Backspace,
|
||||
KeyCode::LeftArrow => Key::Left,
|
||||
KeyCode::ApplicationLeftArrow => Key::Left,
|
||||
KeyCode::RightArrow => Key::Right,
|
||||
KeyCode::ApplicationRightArrow => Key::Right,
|
||||
KeyCode::UpArrow => Key::Up,
|
||||
KeyCode::ApplicationUpArrow => Key::Up,
|
||||
KeyCode::DownArrow => Key::Down,
|
||||
KeyCode::ApplicationDownArrow => Key::Down,
|
||||
KeyCode::LeftArrow | KeyCode::ApplicationLeftArrow => {
|
||||
if modifiers.contains(Modifiers::ALT) {
|
||||
Key::Alt(CharOrArrow::Direction(Direction::Left))
|
||||
} else {
|
||||
Key::Left
|
||||
}
|
||||
}
|
||||
KeyCode::RightArrow | KeyCode::ApplicationRightArrow => {
|
||||
if modifiers.contains(Modifiers::ALT) {
|
||||
Key::Alt(CharOrArrow::Direction(Direction::Right))
|
||||
} else {
|
||||
Key::Right
|
||||
}
|
||||
}
|
||||
KeyCode::UpArrow | KeyCode::ApplicationUpArrow => {
|
||||
if modifiers.contains(Modifiers::ALT) {
|
||||
//Key::AltPlusUpArrow
|
||||
Key::Alt(CharOrArrow::Direction(Direction::Up))
|
||||
} else {
|
||||
Key::Up
|
||||
}
|
||||
}
|
||||
KeyCode::DownArrow | KeyCode::ApplicationDownArrow => {
|
||||
if modifiers.contains(Modifiers::ALT) {
|
||||
Key::Alt(CharOrArrow::Direction(Direction::Down))
|
||||
} else {
|
||||
Key::Down
|
||||
}
|
||||
}
|
||||
KeyCode::Home => Key::Home,
|
||||
KeyCode::End => Key::End,
|
||||
KeyCode::PageUp => Key::PageUp,
|
||||
|
@ -233,7 +233,7 @@ fn unbind_multiple_modes() {
|
||||
|
||||
#[test]
|
||||
fn unbind_single_keybind_single_mode() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('n')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbinds = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
|
||||
@ -250,14 +250,14 @@ fn unbind_single_keybind_single_mode() {
|
||||
let result = mode_keybinds
|
||||
.expect("Mode shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
assert!(result.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unbind_single_keybind_multiple_modes() {
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt('n')]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt('h')]);
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('h'))]);
|
||||
let unbind_from_yaml_n = UnbindFromYaml { unbind: unbind_n };
|
||||
let unbind_from_yaml_h = UnbindFromYaml { unbind: unbind_h };
|
||||
let key_action_unbinds_n = vec![KeyActionUnbind::Unbind(unbind_from_yaml_n)];
|
||||
@ -278,15 +278,18 @@ fn unbind_single_keybind_multiple_modes() {
|
||||
let result_normal = normal
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
let result_pane = pane.expect("Mode shouldn't be empty").0.get(&Key::Alt('h'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_pane = pane
|
||||
.expect("Mode shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt(CharOrArrow::Char('h')));
|
||||
assert!(result_normal.is_none());
|
||||
assert!(result_pane.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unbind_multiple_keybinds_single_mode() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('n'), Key::Ctrl('p')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n')), Key::Ctrl('p')]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbinds = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
|
||||
@ -303,7 +306,7 @@ fn unbind_multiple_keybinds_single_mode() {
|
||||
let result_n = mode_keybinds
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_p = mode_keybinds
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
@ -314,7 +317,7 @@ fn unbind_multiple_keybinds_single_mode() {
|
||||
|
||||
#[test]
|
||||
fn unbind_multiple_keybinds_multiple_modes() {
|
||||
let unbind_normal = Unbind::Keys(vec![Key::Alt('n'), Key::Ctrl('p')]);
|
||||
let unbind_normal = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n')), Key::Ctrl('p')]);
|
||||
let unbind_resize = Unbind::Keys(vec![Key::Char('h'), Key::Ctrl('r')]);
|
||||
let unbind_from_yaml_normal = UnbindFromYaml {
|
||||
unbind: unbind_normal,
|
||||
@ -340,7 +343,7 @@ fn unbind_multiple_keybinds_multiple_modes() {
|
||||
let result_normal_1 = mode_keybinds_normal
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_2 = mode_keybinds_normal
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
@ -361,7 +364,10 @@ fn unbind_multiple_keybinds_multiple_modes() {
|
||||
|
||||
#[test]
|
||||
fn unbind_multiple_keybinds_all_modes() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('n'), Key::Alt('h')]);
|
||||
let unbind = Unbind::Keys(vec![
|
||||
Key::Alt(CharOrArrow::Char('n')),
|
||||
Key::Alt(CharOrArrow::Char('h')),
|
||||
]);
|
||||
let keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
let keybinds_from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
@ -374,7 +380,7 @@ fn unbind_multiple_keybinds_all_modes() {
|
||||
let result_normal_1 = mode_keybinds_normal
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_2 = mode_keybinds_normal
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
@ -395,7 +401,7 @@ fn unbind_multiple_keybinds_all_modes() {
|
||||
|
||||
#[test]
|
||||
fn unbind_all_toplevel_single_key_single_mode() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('h')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('h'))]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbinds_normal = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
let mut keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
@ -411,8 +417,8 @@ fn unbind_all_toplevel_single_key_single_mode() {
|
||||
|
||||
#[test]
|
||||
fn unbind_all_toplevel_single_key_multiple_modes() {
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt('n')]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt('h')]);
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('h'))]);
|
||||
let unbind_from_yaml_n = UnbindFromYaml { unbind: unbind_n };
|
||||
let unbind_from_yaml_h = UnbindFromYaml { unbind: unbind_h };
|
||||
let key_action_unbinds_normal = vec![KeyActionUnbind::Unbind(unbind_from_yaml_n)];
|
||||
@ -431,8 +437,8 @@ fn unbind_all_toplevel_single_key_multiple_modes() {
|
||||
|
||||
#[test]
|
||||
fn unbind_all_toplevel_multiple_key_multiple_modes() {
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt('n'), Key::Ctrl('p')]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt('h'), Key::Ctrl('t')]);
|
||||
let unbind_n = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n')), Key::Ctrl('p')]);
|
||||
let unbind_h = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('h')), Key::Ctrl('t')]);
|
||||
let unbind_from_yaml_n = UnbindFromYaml { unbind: unbind_n };
|
||||
let unbind_from_yaml_h = UnbindFromYaml { unbind: unbind_h };
|
||||
let key_action_unbinds_normal = vec![KeyActionUnbind::Unbind(unbind_from_yaml_n)];
|
||||
@ -472,7 +478,7 @@ fn unbind_single_keybind_all_modes() {
|
||||
let keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -482,25 +488,25 @@ fn unbind_single_keybind_all_modes() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_pane = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_resize = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Resize)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_tab = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Tab)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
|
||||
assert!(result_normal.is_none());
|
||||
assert!(result_pane.is_none());
|
||||
@ -510,14 +516,14 @@ fn unbind_single_keybind_all_modes() {
|
||||
|
||||
#[test]
|
||||
fn unbind_single_toplevel_single_key_single_mode_identical() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('n')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbind = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
let mut keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
keys.insert(InputMode::Normal, key_action_unbind);
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -527,25 +533,25 @@ fn unbind_single_toplevel_single_key_single_mode_identical() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_pane = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_resize = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Resize)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_tab = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Tab)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
|
||||
assert!(result_normal.is_none());
|
||||
assert!(result_pane.is_none());
|
||||
@ -555,14 +561,14 @@ fn unbind_single_toplevel_single_key_single_mode_identical() {
|
||||
|
||||
#[test]
|
||||
fn unbind_single_toplevel_single_key_single_mode_differing() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('l')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('l'))]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbind = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
let mut keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
keys.insert(InputMode::Normal, key_action_unbind);
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -572,25 +578,25 @@ fn unbind_single_toplevel_single_key_single_mode_differing() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
let result_resize_n = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Resize)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_resize_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Resize)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
|
||||
assert!(result_normal_n.is_none());
|
||||
assert!(result_normal_l.is_none());
|
||||
@ -600,7 +606,7 @@ fn unbind_single_toplevel_single_key_single_mode_differing() {
|
||||
|
||||
#[test]
|
||||
fn unbind_single_toplevel_single_key_multiple_modes() {
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('l')]);
|
||||
let unbind = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('l'))]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbind = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
let mut keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
@ -608,7 +614,7 @@ fn unbind_single_toplevel_single_key_multiple_modes() {
|
||||
keys.insert(InputMode::Pane, key_action_unbind);
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -618,25 +624,25 @@ fn unbind_single_toplevel_single_key_multiple_modes() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
let result_pane_n = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_pane_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
|
||||
assert!(result_normal_n.is_none());
|
||||
assert!(result_normal_l.is_none());
|
||||
@ -647,10 +653,10 @@ fn unbind_single_toplevel_single_key_multiple_modes() {
|
||||
#[test]
|
||||
fn unbind_single_toplevel_multiple_keys_single_mode() {
|
||||
let unbind = Unbind::Keys(vec![
|
||||
Key::Alt('l'),
|
||||
Key::Alt('h'),
|
||||
Key::Alt('j'),
|
||||
Key::Alt('k'),
|
||||
Key::Alt(CharOrArrow::Char('l')),
|
||||
Key::Alt(CharOrArrow::Char('h')),
|
||||
Key::Alt(CharOrArrow::Char('j')),
|
||||
Key::Alt(CharOrArrow::Char('k')),
|
||||
]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbind = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
@ -659,7 +665,7 @@ fn unbind_single_toplevel_multiple_keys_single_mode() {
|
||||
keys.insert(InputMode::Pane, key_action_unbind);
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -669,25 +675,25 @@ fn unbind_single_toplevel_multiple_keys_single_mode() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
let result_normal_k = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('k'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('k')));
|
||||
let result_normal_h = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('h'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('h')));
|
||||
|
||||
assert!(result_normal_n.is_none());
|
||||
assert!(result_normal_l.is_none());
|
||||
@ -697,12 +703,15 @@ fn unbind_single_toplevel_multiple_keys_single_mode() {
|
||||
|
||||
#[test]
|
||||
fn unbind_single_toplevel_multiple_keys_multiple_modes() {
|
||||
let unbind_normal = Unbind::Keys(vec![Key::Alt('l'), Key::Ctrl('p')]);
|
||||
let unbind_normal = Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('l')), Key::Ctrl('p')]);
|
||||
let unbind_from_yaml_normal = UnbindFromYaml {
|
||||
unbind: unbind_normal,
|
||||
};
|
||||
let key_action_unbind_normal = vec![KeyActionUnbind::Unbind(unbind_from_yaml_normal)];
|
||||
let unbind = Unbind::Keys(vec![Key::Alt('l'), Key::Alt('k')]);
|
||||
let unbind = Unbind::Keys(vec![
|
||||
Key::Alt(CharOrArrow::Char('l')),
|
||||
Key::Alt(CharOrArrow::Char('k')),
|
||||
]);
|
||||
let unbind_from_yaml = UnbindFromYaml { unbind };
|
||||
let key_action_unbind = vec![KeyActionUnbind::Unbind(unbind_from_yaml)];
|
||||
let mut keys = HashMap::<InputMode, Vec<KeyActionUnbind>>::new();
|
||||
@ -710,7 +719,7 @@ fn unbind_single_toplevel_multiple_keys_multiple_modes() {
|
||||
keys.insert(InputMode::Pane, key_action_unbind);
|
||||
let from_yaml = KeybindsFromYaml {
|
||||
keybinds: keys,
|
||||
unbind: Unbind::Keys(vec![Key::Alt('n')]),
|
||||
unbind: Unbind::Keys(vec![Key::Alt(CharOrArrow::Char('n'))]),
|
||||
};
|
||||
|
||||
let keybinds_from_yaml = Keybinds::get_default_keybinds_with_config(Some(from_yaml));
|
||||
@ -720,7 +729,7 @@ fn unbind_single_toplevel_multiple_keys_multiple_modes() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_normal_p = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Normal)
|
||||
@ -732,7 +741,7 @@ fn unbind_single_toplevel_multiple_keys_multiple_modes() {
|
||||
.get(&InputMode::Normal)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
let result_pane_p = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
@ -744,13 +753,13 @@ fn unbind_single_toplevel_multiple_keys_multiple_modes() {
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('n'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('n')));
|
||||
let result_pane_l = keybinds_from_yaml
|
||||
.0
|
||||
.get(&InputMode::Pane)
|
||||
.expect("ModeKeybinds shouldn't be empty")
|
||||
.0
|
||||
.get(&Key::Alt('l'));
|
||||
.get(&Key::Alt(CharOrArrow::Char('l')));
|
||||
|
||||
assert!(result_normal_n.is_none());
|
||||
assert!(result_normal_l.is_none());
|
||||
|
Loading…
Reference in New Issue
Block a user