~sircmpwn/aerc

config/bindings: allow strings to contain '<' v1 PROPOSED

Elizabeth Hollyburn: 1
 config/bindings: allow strings to contain '<'

 1 files changed, 11 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/25289/mbox | git am -3
Learn more about email & git

[PATCH] config/bindings: allow strings to contain '<' Export this patch

---
 config/bindings.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/config/bindings.go b/config/bindings.go
index 9956b41..3a07505 100644
--- a/config/bindings.go
+++ b/config/bindings.go
@@ -99,6 +99,7 @@ var (
func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
	var strokes []KeyStroke
	buf := bytes.NewBufferString(keystrokes)
	skipNext := false
	for {
		tok, _, err := buf.ReadRune()
		if err == io.EOF {
@@ -106,9 +107,19 @@ func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
		} else if err != nil {
			return nil, err
		}
		if skipNext {
			skipNext = false
			strokes = append(strokes, KeyStroke{
				Key:  tcell.KeyRune,
				Rune: tok,
			})
			continue
		}
		// TODO: make it possible to bind to < or > themselves (and default to
		// switching accounts)
		switch tok {
		case '\\':
			skipNext = true
		case '<':
			name, err := buf.ReadString(byte('>'))
			if err == io.EOF {
2.33.0
shot at a fix for https://todo.sr.ht/~sircmpwn/aerc2/516