aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorBradford Hovinen <hovinen@gmail.com>2024-03-25 15:04:38 +0100
committerGitHub <noreply@github.com>2024-03-25 15:04:38 +0100
commit312817fcf6eb86e394ee72986bd00bede76d70f4 (patch)
tree38aa85346a611dc2c9151a27ca60ce64ee295d72 /src/tests
parentstyle(fmt): fix warnings (#3223) (diff)
downloadsl0ppij-312817fcf6eb86e394ee72986bd00bede76d70f4.tar.gz
sl0ppij-312817fcf6eb86e394ee72986bd00bede76d70f4.tar.xz
sl0ppij-312817fcf6eb86e394ee72986bd00bede76d70f4.zip
fix(config): add support for Ctrl and Alt modifiers on function keys in keybindings (#3179)
Previously, it was not possible to define keybindings with a modifier and a function key. The `Key` enum only supported combinging the Ctrl and Alt modifiers with letters. This is somewhat limiting: I would like to make the Zellij keybindings more "distant" than those used in the programs I use from within Zelilj, so that Zellij does not intefere with those programs. Thus I would like to move some of the keybindings from Ctrl+<character> to Ctrl+<function key>. This change adds: * support for function keys with the Ctrl and Alt modifiers in the `Key` enum, * support for parsing such keybindings from the configuration file, * support for such keybindings in the protobuf which communicates the keybindings to plugins, and * support for these keybindings in the plugin API. This is tested by modifying one of the e2e tests to include an example of such keybindings. This verifies that the configuration is correctly parsed, communicated with the plugin, and rendered.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap2
-rw-r--r--src/tests/fixtures/configs/changed_keys.kdl4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap
index 2f983243..974a63bd 100644
--- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap
+++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap
@@ -25,5 +25,5 @@ expression: last_snapshot
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
- <F1> LOCK  <F2> PANE  <F3> TAB  <F4> RESIZE  <F5> MOVE  <F6> SEARCH  <F7> SESSION  <F8> QUIT 
+ <F1> LOCK  <F2> PANE  <F3> TAB  <F4> RESIZE  <F5> MOVE  <F6> SEARCH  <Alt+F7> SESSION  <Ctrl+F8> QUIT 
Tip: UNBOUND => open new pane. UNBOUND => navigate between panes. UNBOUND => increase/decrease pane size.
diff --git a/src/tests/fixtures/configs/changed_keys.kdl b/src/tests/fixtures/configs/changed_keys.kdl
index 6123b1d5..c8bed1be 100644
--- a/src/tests/fixtures/configs/changed_keys.kdl
+++ b/src/tests/fixtures/configs/changed_keys.kdl
@@ -6,7 +6,7 @@ keybinds clear-defaults=true {
bind "F4" { SwitchToMode "Resize"; }
bind "F5" { SwitchToMode "Move"; }
bind "F6" { SwitchToMode "Scroll"; }
- bind "F7" { SwitchToMode "Session"; }
- bind "F8" { Quit; }
+ bind "Alt F7" { SwitchToMode "Session"; }
+ bind "Ctrl F8" { Quit; }
}
}