From 029ff639293efc34c72139e445a8ff452c1da408 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Sat, 16 Apr 2022 00:43:36 +0200 Subject: [PATCH] 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 \> = :next-tab \ = :filter Fixes: https://todo.sr.ht/~rjarry/aerc/37 Signed-off-by: Koni Marti Tested-by: Sebastian LaVine Acked-by: Robin Jarry --- config/bindings.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/bindings.go b/config/bindings.go index 7ff0c24..4be37de 100644 --- a/config/bindings.go +++ b/config/bindings.go @@ -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,