binds: allow to bind a command to < and >

Allow to bind to < and > by using \< and \> in binds.conf. Ensure that
the single \ can still be properly used to bind to other commands.

For example, the following binds would work now:
\< = :prev-tab<Enter>
\> = :next-tab<Enter>
\ = :filter<space>

Fixes: https://todo.sr.ht/~rjarry/aerc/37
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Sebastian LaVine <mail@smlavine.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-04-16 00:43:36 +02:00 committed by Robin Jarry
parent 7a7b9df763
commit 029ff63929
1 changed files with 8 additions and 0 deletions

View File

@ -199,6 +199,14 @@ func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
}
case '>':
return nil, errors.New("Found '>' without '<'")
case '\\':
tok, _, err = buf.ReadRune()
if err == io.EOF {
tok = '\\'
} else if err != nil {
return nil, err
}
fallthrough
default:
strokes = append(strokes, KeyStroke{
Modifiers: tcell.ModNone,