Skip to content

Conversation

security-log
Copy link

Fixes #641

Changes

Modified: command.go
Keep the Shift modifier held while typing navigation keys so Shift+Arrow/Page/Home/End fire the correct rod key codes.

Modified: parser/parser.go
Allow Shift commands to consume navigation tokens (Arrow, Page, Home, End) in addition to the existing literals.

Modified: parser/parser_test.go
Add coverage for parsing Shift+Down and Shift+Tab.

Modified: record.go
Map Shift+Arrow escape sequences, sort substitutions by length to avoid partial matches, and preserve Shift-prefixed commands during sanitization.

Modified: record_test.go
Verify that the recorder now turns Shift+Arrow escape sequences into Shift+… commands.

Why

Shifted navigation keys were emitted as plain text (Down, Up) or broken into Escape fragments, so we couldn’t replay selections made with Shift while recording or parsing tapes. These changes teach the recorder, parser, and executor to treat shifted navigation as first-class commands.

How to reproduce

Before the fix

go test ./record -run TestInputToTape/Shift+Arrow -count=1
--- FAIL: TestInputToTape (0.00s)
    record_test.go:...: want:
    Shift+Down
    ...
    got:
    Escape
    [1;2B
    ...

After the fix

go test ./record -run TestInputToTape/Shift+Arrow -count=1
ok   github.com/charmbracelet/vhs/record

@security-log security-log requested a review from a team as a code owner October 17, 2025 14:11
@security-log security-log requested review from meowgorithm and tauraamui and removed request for a team October 17, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't combine Shift and Down

1 participant