fix: stop cross-window iTerm2 jumps from failing with Invalid index - #10
Merged
Conversation
The iTerm2 focuser walked windows with `repeat with w in windows`, whose loop variable is a positional reference (`item M of every window`). When window order shifted mid-scan — which happens right after another jump, or when you click a different window — the next access raised AppleScript error -1719 and the jump failed outright. Measured: jumping back and forth between two iTerm2 windows failed 3/3 on the return jump. The scan now addresses windows by index inside a retry: if the order moves under it, it rescans instead of failing. After `select`, the tab and session are re-located relative to `current window` rather than the stale scan position, and the result is verified against `current session of current window` before reporting success — a jump that cannot raise the window (a window on another Space, for example) now reports "找不到⋯沒浮到前景" instead of silently claiming it jumped. Every jump attempt is now logged to `~/.config/ring/focus.jsonl` with each focuser's answer, so an intermittent "it didn't jump" can be attributed afterwards instead of relying on a toast nobody kept.
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.
The iTerm2 focuser walked windows with
repeat with w in windows, whose loop variable is a positional reference (item M of every window). When window order shifted mid-scan — which happens right after another jump, or when you click a different window — the next access raised AppleScript error -1719 and the jump failed outright. Measured: jumping back and forth between two iTerm2 windows failed 3/3 on the return jump.The scan now addresses windows by index inside a retry: if the order moves under it, it rescans instead of failing. After
select, the tab and session are re-located relative tocurrent windowrather than the stale scan position, and the result is verified againstcurrent session of current windowbefore reporting success — a jump that cannot raise the window (a window on another Space, for example) now reports "找不到⋯沒浮到前景" instead of silently claiming it jumped.Every jump attempt is now logged to
~/.config/ring/focus.jsonlwith each focuser's answer, so an intermittent "it didn't jump" can be attributed afterwards instead of relying on a toast nobody kept.