-
Notifications
You must be signed in to change notification settings - Fork 162
Prevent errors when runner is closed by something other than vimux #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances runner-existence checks and prevents errors when the tmux runner is closed externally by any method other than Vimux.
- Introduces a parameterless
s:hasRunner()
function and replaces ad-hocexists()
checks with it. - Adds internal helpers
s:sendKeys
,s:sendText
, and a unifieds:echoNoRunner()
fallback. - Updates all runner-related commands (open, close, toggle, inspect, scroll, interrupt, clear) to use the new helpers.
Comments suppressed due to low confidence (4)
plugin/vimux.vim:379
- [nitpick] The message uses lowercase “vimux” but the command is
VimuxOpenRunner
. For clarity and consistency with other messages, capitalize “Vimux”.
echo 'No vimux runner pane/window. Create one with VimuxOpenRunner'
plugin/vimux.vim:84
- New branches where
s:hasRunner()
is false now echo an error rather than throwing. Consider adding or updating tests to cover the no-runner fallback paths ands:echoNoRunner()
behavior.
if s:hasRunner()
plugin/vimux.vim:371
- [nitpick] Each
s:sendKeys
invocation now runs alist-…
check vias:hasRunner
, and then spawns a separate tmux command forsend-keys
. This could introduce noticeable overhead for rapid key sequences. Consider cachingg:VimuxRunnerIndex
validity or batching multiple sends to reduce repeated tmux calls.
call VimuxTmux('send-keys -t '.g:VimuxRunnerIndex.' '.a:keys)
plugin/vimux.vim:375
- [nitpick] Indentation here uses four spaces while other
s:
functions use two spaces. Aligning on a single indentation style will improve readability and consistency.
call s:sendKeys(shellescape(substitute(a:text, '\n$', ' ', '')))
No, if I'm pretty satisfied it is in good hands even if I don't have attention to give it at any given moment. Monitoring from the sidelines is good enough by me — if I can find the right settings far that. Edit: Are you sure you can't override the need for a review already? It looks like I already made you an admin on this repo so you should have that option. |
Yeah I can- I figured I should check before I start merging my work in without review though 😁 Thank you! |
No worries, use your judgement, that's why you have the buttons already. If you think something is questionable and want another pair of eyes feel free to explicitly push the "request review from" thing and hope it hits my radar. If it doesn't in a reasonable time frame don't sweat it. Pinging users that reported related issues can help too. But for any cases you're confident something is an clear win, has been tested, and/or you have feedback from other users, just merge at will. 🚀 |
As seen in #236, if the runner was already manually closed when we call
VimuxCloseRunner
we get the following error:This is an annoyance for people who use
VimuxCloseOnExit
. The error could spread to other commands as well, since the error prevents vimux from unsettingVimuxRunnerIndex
, leading other commands to believe the runner is still available.The error can occur in other contexts too, as seen in #229.
We generally only check if the
VimuxRunnerIndex
variable is defined before attempting to interact with the runner. This variable is only unset if vimux closes the runner, so any time anything else loses the runner we will get errors.We have some options:
I think for now I'll just enhance the checks we already have to make sure that the runner actually exists, rather than just checking for the index variable's existence.