Add support for function keys (F1–F12)#757
Open
kirby88 wants to merge 1 commit into
Open
Conversation
Adds F1 through F12 as repeatable keypress commands, following the existing pattern used by keys like PageUp: - token: new F1–F12 token constants, keyword mappings, and IsCommand - parser: F1–F12 added to CommandTypes and the keypress switch, so they accept the standard `Key[@<time>] [count]` grammar - command: CommandFuncs entries mapping each F-key to ExecuteKey with the corresponding go-rod input.Fn key - record: F-key terminal escape sequences so `vhs record` captures them - docs: man page and README "Function Keys" section - tests: lexer/parser F-key tests; updated command count assertions Co-authored-by: vix <290354907+vix-agent@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the function keys F1–F12 as tape commands, so tapes can drive TUIs and apps that bind function keys (e.g. switching tabs/panes).
They follow the exact pattern of existing keypress commands like
PageUp, including the optional@<time>and repeat-count grammar:Changes
F1–F12token constants,Keywordsmappings, andIsCommandentries.F1–F12added toCommandTypesand theparseCommandkeypress switch, routing throughparseKeypress(so@time/repeat work).CommandFuncsentries mapping each F-key toExecuteKey(input.Fn)— go-rod already definesinput.F1–input.F12.EscapeSequencessovhs recordcaptures them.command_test.gocommand-count assertions (31 → 43).No lexer change was required —
readIdentifieralready accepts digits, soF3lexes as a single identifier token.Testing
go build ./...,go vet ./...,go test ./...all pass;gofmtclean.vhs validateaccepts a tape usingF3,F12@200ms 2, andF1 3.Notes
Ctrl+F3,Shift+F12) are intentionally not included in this PR to keep it focused; happy to add as a follow-up.