fix: suppress fish shadow warning corrupting config-toggle redraw #48
Reference in New Issue
Block a user
Delete Branch "fix/config-toggle-shadow-warning-redraw"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the
config-toggleTUI 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: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[Jthen cleared from there down, leaving the old top border behind to accumulate on every toggle and persist after exit.This explains every observed detail:
DEFAULT= no shadow = no warning = no bug.DEFAULTon one side.fish -ic: the warning only fires in a real interactive TTY, which is why it was hard to reproduce in scripted tests (confirmed viascript -qec 'fish -i').Fix
Suppress stderr (
2>/dev/null) on the sixsetcommands infunctions/__config_toggle_apply.fish. The warning is expected noise here, sinceconfig-toggleintentionally 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.mdupdates needed.Manual Verification
config-toggle. Set a category (e.g. Logging) to ON in Session (Tab to Session scope, press →).┌─ Opinionated Settings ─┐top border does not duplicate/stack as you toggle.qto exit and confirm no leftover top-border lines remain in the scrollback.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.