From ee5f82579ff09ccd58641473547a929163fb8b97 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 19 May 2020 14:41:55 -0400 Subject: [PATCH] Don't treat the space character as a control character There are drawbacks to both sides of this, but in the end, it seems to make more sense to treat spaces as regular runes. --- key.go | 6 ------ viewport/viewport.go | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/key.go b/key.go index 02d72a9..eff9e95 100644 --- a/key.go +++ b/key.go @@ -256,12 +256,6 @@ func ReadKey(r io.Reader) (Key, error) { return Key{Type: KeyType(char)}, nil } - // If it's a space treat it like a control character (otherwise it gets - // treated as the character " " - if string(char) == " " { - return Key{Type: KeyType(keySP)}, nil - } - // Is it a special sequence, like an arrow key? if k, ok := sequences[string(buf[:numBytes])]; ok { return Key{Type: k}, nil diff --git a/viewport/viewport.go b/viewport/viewport.go index 2301883..56a3d68 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -86,7 +86,7 @@ func Update(msg boba.Msg, m Model) (Model, boba.Cmd) { // Down one page case "pgdown": fallthrough - case "space": + case " ": // spacebar fallthrough case "f": m.ViewDown()