Conversation
- every(N) fires every N seconds (fractional, floored to 0.01s) - Encoded as tui.Every with duration in Char as milliseconds, so every(1) and every(2) coexist as distinct keymap entries - FZF_IDLE_TIME exposes whole seconds since the last user activity (keystroke or mouse event); pair with every() for idle-based patterns like auto-accept/auto-quit Close #1211
There was a problem hiding this comment.
Pull request overview
Adds a timer-driven every(N) bind event and a new FZF_IDLE_TIME environment variable to support idle/time-based automations in fzf (e.g., periodic reloads, auto-accept after inactivity).
Changes:
- Introduces
every(N)as a new bindable event type (tui.Every) with millisecond resolution. - Starts per-
every()tickers in the terminal loop and exportsFZF_IDLE_TIMEto child processes. - Adds Go + Ruby integration tests and updates the man page + changelog documentation.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_core.rb | Adds integration tests for every() behavior, unbind, and FZF_IDLE_TIME. |
| src/tui/tui.go | Adds Every event type and formats every(N) in Event.KeyName(). |
| src/tui/eventtype_string.go | Updates generated EventType stringer output to include Every. |
| src/terminal.go | Adds timer channel + ticker startup and exports FZF_IDLE_TIME. |
| src/options.go | Parses every(N) chord specs into a tui.Every event with ms payload. |
| src/options_test.go | Adds unit coverage for parsing and key registration of every(N). |
| man/man1/fzf.1 | Documents every(N) and FZF_IDLE_TIME, including usage examples. |
| CHANGELOG.md | Announces the new event and environment variable with examples. |
Files not reviewed (1)
- src/tui/eventtype_string.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Char is rune (int32). Without an upper bound, secs * 1000 could silently wrap to a non-positive value and panic time.NewTicker.
Move Invalid, Fatal, and BracketedPasteBegin/End into the same synthetic block as Resize, Start, Load, etc. The single boundary (>= Invalid) now covers every non-user event, replacing the explicit list in the keyChan activity check. BracketedPaste markers sit in the synthetic block because the paste content itself arrives as Rune events and updates lastActivity.
Seconds resolution is too coarse to combine with sub-second every() bindings. Switching to milliseconds gives idle-based scripts useful resolution at any every() interval.
Seconds is more ergonomic for shell threshold checks; milliseconds covers sub-second every() bindings. Exporting both lets the same script pick whichever resolution matches its every() interval.
lastKey was overwritten every time a synthetic event (every(N), Focus, Result, ...) was processed, so FZF_KEY would briefly show "every(1)" or empty string instead of the user's actual last keystroke. Gate the assignment on `< Invalid` so only user-input events update lastKey, and drop the now-unused every() formatting in KeyName.
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.
Close #1211
Acknowledgement