Skip to content

Commit 637e426

Browse files
alexwforsythemaaslalani
authored andcommitted
parser: allow Ctrl+Space
1 parent a3c67e0 commit 637e426

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ func ExecuteCtrl(c Command, v *VHS) {
167167
inputKey = &input.AltLeft
168168
case "Enter":
169169
inputKey = &input.Enter
170+
case "Space":
171+
inputKey = &input.Space
170172
default:
171173
r := rune(key[0])
172174
if k, ok := keymap[r]; ok {

parser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ func (p *Parser) parseCtrl() Command {
161161
// Add key argument.
162162
switch {
163163
case peek.Type == ENTER,
164+
peek.Type == SPACE,
164165
peek.Type == STRING && len(peek.Literal) == 1:
165166
args = append(args, peek.Literal)
166167
default:

parser_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ func TestParseCtrl(t *testing.T) {
226226
wantErr: false,
227227
},
228228
{
229-
name: "Ctrl+Alt+Right",
230229
tape: "Ctrl+Alt+Right",
231230
wantErr: true,
232231
},
@@ -235,6 +234,12 @@ func TestParseCtrl(t *testing.T) {
235234
tape: "Ctrl+Backspace",
236235
wantErr: true,
237236
},
237+
{
238+
name: "Ctrl+Space",
239+
tape: "Ctrl+Space",
240+
wantArgs: []string{"Space"},
241+
wantErr: false,
242+
},
238243
}
239244

240245
for _, tc := range tests {

0 commit comments

Comments
 (0)