Skip to content

fix: status-left corruption, stderr leaks, and stale saved-state bugs - #7

Merged
danyim merged 2 commits into
masterfrom
fix/code-review-bugs
Jun 16, 2026
Merged

fix: status-left corruption, stderr leaks, and stale saved-state bugs#7
danyim merged 2 commits into
masterfrom
fix/code-review-bugs

Conversation

@danyim

@danyim danyim commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Why?

Several bugs could silently corrupt the user's status bar or leak errors to the terminal: calling toggle_off before toggle_on would blank status-left permanently; toggling on/off more than once per session would cause toggle_off to restore a stale snapshot; and unguarded tmux show-option calls would print errors to stderr on every fresh plugin load.

How?

Guard toggle_off against an empty saved value, clear the saved state after each restore cycle, suppress stderr from tmux show-option on unset options (matching the pattern already used in toggle_off), split local declarations from command substitutions to preserve exit codes, suppress key not found errors from unbind on fresh install, and fix the broken shebang in test_default_options.sh.

danyim added 2 commits June 16, 2026 15:21
- 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
@danyim
danyim merged commit 8eaa6c1 into master Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant