Skip to content

Commit 182a42a

Browse files
alexwforsythemaaslalani
authored andcommitted
parser: allow Ctrl+Backspace
1 parent 03b1986 commit 182a42a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ func ExecuteCtrl(c Command, v *VHS) {
169169
inputKey = &input.Enter
170170
case "Space":
171171
inputKey = &input.Space
172+
case "Backspace":
173+
inputKey = &input.Backspace
172174
default:
173175
r := rune(key[0])
174176
if k, ok := keymap[r]; ok {

parser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func (p *Parser) parseCtrl() Command {
172172
switch {
173173
case peek.Type == ENTER,
174174
peek.Type == SPACE,
175+
peek.Type == BACKSPACE,
175176
peek.Type == STRING && len(peek.Literal) == 1:
176177
args = append(args, peek.Literal)
177178
default:

parser_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ func TestParseCtrl(t *testing.T) {
234234
wantErr: true,
235235
},
236236
{
237-
name: "Ctrl+Backspace",
238-
tape: "Ctrl+Backspace",
239-
wantErr: true,
237+
name: "Ctrl+Backspace",
238+
tape: "Ctrl+Backspace",
239+
wantArgs: []string{"Backspace"},
240+
wantErr: false,
240241
},
241242
{
242243
name: "Ctrl+Space",

0 commit comments

Comments
 (0)