Target the invoking pane instead of --current - #8
Open
cunderw wants to merge 1 commit into
Open
Conversation
`--current` resolves to the herdr server's globally focused pane, not the pane the plugin action was invoked from. The script already knows its own pane via $HERDR_PANE_ID and uses it for send-keys, so the information was already available at both call sites. Two consequences when focus and caller diverge: - navigate.sh:41 tested whether the *focused* pane was running Vim and then acted on $HERDR_PANE_ID, so it could forward a key into a pane not running Vim, or move focus when it should have forwarded. - navigate.sh:53 and editor/nvim.lua:26 moved focus relative to the wrong source pane. --current is kept as a fallback in navigate.sh for invocation outside a pane, where $HERDR_PANE_ID is unset and `--pane ""` would be invalid. The nvim.lua change needs no guard because that branch only runs when HERDR_PANE_ID is non-empty. Refs paulbkim-dev#7 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QP5QBZ1kpDBmajU1u7cef7
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.
Fixes #7.
--currentresolves to the herdr server's globally focused pane, not the pane the plugin action was invoked from. The script already knows its own pane via$HERDR_PANE_ID— it uses it forsend-keys— so this just uses it for the other two calls as well.Changes
navigate.sh:41pane process-info --currentpane process-info --pane "$pane"navigate.sh:53pane focus … --currentpane focus … --pane "$pane"editor/nvim.lua:26"--current""--pane", vim.env.HERDR_PANE_ID--currentis kept as a fallback innavigate.shfor invocation outside a pane, where$HERDR_PANE_IDis unset and--pane ""would be invalid. Thenvim.luachange needs no guard because that branch only runs whenHERDR_PANE_IDis non-empty.Verification
Invoking the script from a pane that is not the focused one, before and after:
source_pane_idw7:p2— the globally focused panewA:p1— the invoking paneThe detection change at line 41 is the more consequential of the two: a wrong answer there means keys get forwarded into a pane that isn't running Vim, or focus moves when the key should have been forwarded.
Running this patch locally on herdr 0.7.5 / Neovim 0.12.0-dev / macOS arm64; both navigation directions behave correctly.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QP5QBZ1kpDBmajU1u7cef7