Skip to content

Commit

Permalink
parser: allow Ctrl+Backspace
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwforsythe committed Dec 11, 2023
1 parent 8e9b90c commit 687c399
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ func ExecuteCtrl(c Command, v *VHS) {
inputKey = &input.Enter
case "Space":
inputKey = &input.Space
case "Backspace":
inputKey = &input.Backspace
default:
r := rune(key[0])
if k, ok := keymap[r]; ok {
Expand Down
1 change: 1 addition & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func (p *Parser) parseCtrl() Command {
switch {
case peek.Type == ENTER,
peek.Type == SPACE,
peek.Type == BACKSPACE,
peek.Type == STRING && len(peek.Literal) == 1:
args = append(args, peek.Literal)
default:
Expand Down
7 changes: 4 additions & 3 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,10 @@ func TestParseCtrl(t *testing.T) {
wantErr: true,
},
{
name: "Ctrl+Backspace",
tape: "Ctrl+Backspace",
wantErr: true,
name: "Ctrl+Backspace",
tape: "Ctrl+Backspace",
wantArgs: []string{"Backspace"},
wantErr: false,
},
{
name: "Ctrl+Space",
Expand Down

0 comments on commit 687c399

Please sign in to comment.