fix: status-left corruption, stderr leaks, and stale saved-state bugs - #7
Merged
Conversation
- toggle_off: guard against empty saved value to prevent blanking status-left when called before toggle_on or after server restart - toggle_off: clear @remote-saved-status-left after restoring it, so subsequent toggle_on cycles capture a fresh snapshot rather than re-using a stale one from a previous cycle - toggle_on/helpers: suppress stderr from tmux show-option on unset options (2>/dev/null), matching the pattern already used in toggle_off - helpers: split local declaration from assignment so tmux exit codes are not masked by the local builtin - remote.tmux: suppress expected "key not found" errors from unbind calls on fresh plugin load; split local declarations from assignments - tests/test_default_options: fix broken shebang (was missing ! and indented, causing the test to run under /bin/sh); quote $CURRENT_DIR in source to handle paths with spaces
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.
Why?
Several bugs could silently corrupt the user's status bar or leak errors to the terminal: calling
toggle_offbeforetoggle_onwould blankstatus-leftpermanently; toggling on/off more than once per session would causetoggle_offto restore a stale snapshot; and unguardedtmux show-optioncalls would print errors to stderr on every fresh plugin load.How?
Guard
toggle_offagainst an empty saved value, clear the saved state after each restore cycle, suppress stderr fromtmux show-optionon unset options (matching the pattern already used intoggle_off), splitlocaldeclarations from command substitutions to preserve exit codes, suppresskey not founderrors fromunbindon fresh install, and fix the broken shebang intest_default_options.sh.