fix: suppress fish shadow warning corrupting config-toggle redraw #48

Merged
rootiest merged 1 commits from fix/config-toggle-shadow-warning-redraw into main 2026-06-12 21:41:22 +00:00
Owner

Summary

Fixes the config-toggle TUI bug where the top border line (┌─ Opinionated Settings ─┐) was redrawn and stacked on repeated toggles, leaving leftover lines after exit.

Root cause

The trigger was a state, not a row position: a category variable set explicitly in both universal and session scope. In that state, interactive fish prints a one-line stderr warning on each set -U / set -g:

set: successfully set universal 'X'; but a global by that name shadows it

That stray line landed on the terminal between the apply and the in-place panel redraw. The redraw uses \e[14A (cursor-up exactly 14 lines), so the extra line made it land one row low — on the scope-tab line instead of the top border. \e[J then cleared from there down, leaving the old top border behind to accumulate on every toggle and persist after exit.

This explains every observed detail:

  • Only fires when both scopes are explicit (a shadow exists); any side at DEFAULT = no shadow = no warning = no bug.
  • The apparent row-immunity (aliases/overrides/autoexec) was incidental — those rows happened to have a DEFAULT on one side.
  • Invisible under fish -ic: the warning only fires in a real interactive TTY, which is why it was hard to reproduce in scripted tests (confirmed via script -qec 'fish -i').

Fix

Suppress stderr (2>/dev/null) on the six set commands in functions/__config_toggle_apply.fish. The warning is expected noise here, since config-toggle intentionally edits both scopes independently. A comment documents the why, including the interactive-TTY-only gotcha.

No user-facing behavior change → no README / docs/fish-config.md updates needed.

Manual Verification

  • Run config-toggle. Set a category (e.g. Logging) to ON in Session (Tab to Session scope, press →).
  • Tab back to Universal scope and toggle the same category repeatedly (← / →).
  • Confirm the ┌─ Opinionated Settings ─┐ top border does not duplicate/stack as you toggle.
  • Press q to exit and confirm no leftover top-border lines remain in the scrollback.
  • Repeat for Integrations, Greeting, and Master — all previously affected rows.
  • Sanity check a row with one side at DEFAULT still behaves correctly (was never broken).
## Summary Fixes the `config-toggle` TUI bug where the top border line (`┌─ Opinionated Settings ─┐`) was redrawn and **stacked** on repeated toggles, leaving leftover lines after exit. ## Root cause The trigger was a **state**, not a row position: a category variable set explicitly in **both** universal *and* session scope. In that state, interactive fish prints a one-line stderr warning on each `set -U` / `set -g`: ``` set: successfully set universal 'X'; but a global by that name shadows it ``` That stray line landed on the terminal **between** the apply and the in-place panel redraw. The redraw uses `\e[14A` (cursor-up exactly 14 lines), so the extra line made it land one row low — on the scope-tab line instead of the top border. `\e[J` then cleared from there down, leaving the old top border behind to accumulate on every toggle and persist after exit. This explains every observed detail: - Only fires when both scopes are explicit (a shadow exists); any side at `DEFAULT` = no shadow = no warning = no bug. - The apparent row-immunity (aliases/overrides/autoexec) was incidental — those rows happened to have a `DEFAULT` on one side. - Invisible under `fish -ic`: the warning only fires in a **real interactive TTY**, which is why it was hard to reproduce in scripted tests (confirmed via `script -qec 'fish -i'`). ## Fix Suppress stderr (`2>/dev/null`) on the six `set` commands in `functions/__config_toggle_apply.fish`. The warning is expected noise here, since `config-toggle` intentionally edits both scopes independently. A comment documents the why, including the interactive-TTY-only gotcha. No user-facing behavior change → no README / `docs/fish-config.md` updates needed. ## Manual Verification - [x] Run `config-toggle`. Set a category (e.g. Logging) to **ON** in **Session** (Tab to Session scope, press →). - [x] Tab back to **Universal** scope and toggle the **same** category repeatedly (← / →). - [x] Confirm the `┌─ Opinionated Settings ─┐` top border does **not** duplicate/stack as you toggle. - [x] Press `q` to exit and confirm **no** leftover top-border lines remain in the scrollback. - [x] Repeat for Integrations, Greeting, and Master — all previously affected rows. - [x] Sanity check a row with one side at **DEFAULT** still behaves correctly (was never broken).
rootiest added 1 commit 2026-06-12 21:40:48 +00:00
When a category variable is set explicitly in both universal and session
scope, interactive fish prints a one-line stderr warning ("successfully set
universal 'X'; but a global by that name shadows it") on each `set -U`/`set
-g`. That stray line landed between the apply and the in-place panel redraw,
pushing the cursor down one row so the `\e[14A` cursor-up no longer reached
the top border — leaving it behind to stack on every toggle and persist
after exit.

Suppress stderr on the six set commands in __config_toggle_apply. The
warning is expected noise here since config-toggle edits both scopes
independently. The warning only fires in a real interactive TTY (not under
`fish -ic`), which is why it was easy to miss when testing.
rootiest merged commit 95f2ad9112 into main 2026-06-12 21:41:22 +00:00
rootiest deleted branch fix/config-toggle-shadow-warning-redraw 2026-06-12 21:41:22 +00:00
Sign in to join this conversation.