From 4210f3b445307c07ea38d17c62ec388e9283fea3 Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 12 Jun 2026 17:40:18 -0400 Subject: [PATCH] fix: suppress fish shadow warning corrupting config-toggle redraw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- functions/__config_toggle_apply.fish | 21 +++++++++++++++------ functions/config-toggle.fish | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/functions/__config_toggle_apply.fish b/functions/__config_toggle_apply.fish index 7ce27d0..b04f961 100644 --- a/functions/__config_toggle_apply.fish +++ b/functions/__config_toggle_apply.fish @@ -30,24 +30,33 @@ function __config_toggle_apply set -l scope $argv[2] set -l value $argv[3] + # stderr is suppressed because setting a value in one scope while the + # other scope already holds the same variable makes interactive fish + # emit a shadowing warning ("set: successfully set universal 'X'; but a + # global by that name shadows it"). config-toggle intentionally edits + # both scopes independently, so the warning is expected noise — and if + # it reached the terminal it would push the cursor down a row and + # corrupt the in-place panel redraw (leaving a stacked top border + # behind). Note: the warning only fires in a real interactive TTY, not + # under `fish -ic`, which is why it is easy to miss when testing. switch $scope case universal switch $value case on - set -U $varname on + set -U $varname on 2>/dev/null case off - set -U $varname off + set -U $varname off 2>/dev/null case DEFAULT - set -Ue $varname + set -Ue $varname 2>/dev/null end case session switch $value case on - set -g $varname on + set -g $varname on 2>/dev/null case off - set -g $varname off + set -g $varname off 2>/dev/null case DEFAULT - set -eg $varname + set -eg $varname 2>/dev/null end end end diff --git a/functions/config-toggle.fish b/functions/config-toggle.fish index 2cac262..a3e5b7f 100644 --- a/functions/config-toggle.fish +++ b/functions/config-toggle.fish @@ -149,5 +149,6 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c # ── Cleanup ─────────────────────────────────────────── trap - INT # remove the signal handler + printf '\e[%dA\e[J' $panel_h # erase the panel printf '\e[?25h' # restore cursor end