Skip to content

Commit 59a14d0

Browse files
committed
feat: Alt+Enter
1 parent 22854ac commit 59a14d0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

command.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,19 @@ func ExecuteCtrl(c Command, v *VHS) {
154154
// held down on the running instance of vhs.
155155
func ExecuteAlt(c Command, v *VHS) {
156156
_ = v.Page.Keyboard.Press(input.AltLeft)
157-
for _, r := range c.Args {
158-
if k, ok := keymap[r]; ok {
159-
_ = v.Page.Keyboard.Type(k)
157+
if k, ok := keywords[c.Args]; ok {
158+
switch k {
159+
case ENTER:
160+
_ = v.Page.Keyboard.Type(input.Enter)
161+
}
162+
} else {
163+
for _, r := range c.Args {
164+
if k, ok := keymap[r]; ok {
165+
_ = v.Page.Keyboard.Type(k)
166+
}
160167
}
161168
}
169+
162170
_ = v.Page.Keyboard.Release(input.AltLeft)
163171
}
164172

parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (p *Parser) parseCtrl() Command {
154154
func (p *Parser) parseAlt() Command {
155155
if p.peek.Type == PLUS {
156156
p.nextToken()
157-
if p.peek.Type == STRING {
157+
if p.peek.Type == STRING || p.peek.Type == ENTER {
158158
c := p.peek.Literal
159159
p.nextToken()
160160
return Command{Type: ALT, Args: c}

0 commit comments

Comments
 (0)