aboutsummaryrefslogtreecommitdiffstats
path: root/config/bindings_test.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-10-25 15:00:43 +0200
committerRobin Jarry <robin@jarry.cc>2021-10-28 16:21:37 +0200
commit7a6c808c042bf6f662e6d6b6dba09829a1f9ed15 (patch)
treef765cba8bfecd83f787e355c688c3ebc78fb7d10 /config/bindings_test.go
parent0b19b5e70e408bbaac5555b0b61a9451189406f8 (diff)
downloadaerc-7a6c808c042bf6f662e6d6b6dba09829a1f9ed15.tar.gz
bindings: prepare for more modifers
Prepare to support more modifiers in key bindings. tcell has some premade ctrl-modified keys but not all keys are supported. Other keys must be explicitly checked with a modifier mask. Update the KeyStroke type to carry a modifier mask. Update code accordingly. No functional change. Link: https://github.com/gdamore/tcell/blob/master/key.go#L265-L275 Link: https://github.com/gdamore/tcell/blob/master/key.go#L384-L419 Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/bindings_test.go')
-rw-r--r--config/bindings_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/config/bindings_test.go b/config/bindings_test.go
index 44597362..d07d65a7 100644
--- a/config/bindings_test.go
+++ b/config/bindings_test.go
@@ -32,30 +32,30 @@ func TestGetBinding(t *testing.T) {
}
test([]KeyStroke{
- {tcell.KeyRune, 'a'},
+ {tcell.ModNone, tcell.KeyRune, 'a'},
}, BINDING_INCOMPLETE, "")
test([]KeyStroke{
- {tcell.KeyRune, 'a'},
- {tcell.KeyRune, 'b'},
- {tcell.KeyRune, 'c'},
+ {tcell.ModNone, tcell.KeyRune, 'a'},
+ {tcell.ModNone, tcell.KeyRune, 'b'},
+ {tcell.ModNone, tcell.KeyRune, 'c'},
}, BINDING_FOUND, ":abc")
test([]KeyStroke{
- {tcell.KeyRune, 'c'},
- {tcell.KeyRune, 'b'},
- {tcell.KeyRune, 'a'},
+ {tcell.ModNone, tcell.KeyRune, 'c'},
+ {tcell.ModNone, tcell.KeyRune, 'b'},
+ {tcell.ModNone, tcell.KeyRune, 'a'},
}, BINDING_FOUND, ":cba")
test([]KeyStroke{
- {tcell.KeyRune, 'f'},
- {tcell.KeyRune, 'o'},
+ {tcell.ModNone, tcell.KeyRune, 'f'},
+ {tcell.ModNone, tcell.KeyRune, 'o'},
}, BINDING_INCOMPLETE, "")
test([]KeyStroke{
- {tcell.KeyRune, '4'},
- {tcell.KeyRune, '0'},
- {tcell.KeyRune, '4'},
+ {tcell.ModNone, tcell.KeyRune, '4'},
+ {tcell.ModNone, tcell.KeyRune, '0'},
+ {tcell.ModNone, tcell.KeyRune, '4'},
}, BINDING_NOT_FOUND, "")
add("<C-a>", "c-a")
test([]KeyStroke{
- {tcell.KeyCtrlA, 0},
+ {tcell.ModCtrl, tcell.KeyCtrlA, 0},
}, BINDING_FOUND, "c-a")
}