Files
dotfiles/platforms/home-manager/modules/nmasur/presets/programs/lag-triage/autosuggestion-unwedge.fish
T
Noah Masur d4e56dd190 post-TUI lag: autosuggestion culprit confirmed; add self-heal hook
A/B in a live lagging shell: disabling fish_autosuggestion_enabled cures
the lag instantly, and re-enabling does NOT bring it back — the toggle
resets the wedged reader state. __autosuggestion_unwedge (fish_postexec)
now applies that reset after every command, at the moment TUIs exit.
Builtins only, invisible, respects a deliberate manual disable. Flight
recorder stays armed until the hook is proven in real use.

Also from this investigation: wedged-thread evidence (sampler attach
cures), lag-sample tool, flight recorder in the zellij fish wrapper.
2026-09-07 11:17:44 -04:00

22 lines
1.1 KiB
Fish

# Self-heal for the post-TUI typing lag (fish 4.8.1, see docs/CHANGELOG.md
# 2026-08-29..31): exiting a TUI can wedge fish's autosuggestion pipeline,
# after which every keystroke at the commandline lags until the process is
# replaced. Empirically validated cure: turn autosuggestions off and back on
# in the affected shell. This hook applies that reset after every command —
# i.e. at the exact moment a TUI has just exited — using only builtins, so it
# is effectively free and invisible.
#
# Caveats, recorded for honesty: the manual cure had keystrokes between the
# off and the on; whether an immediate off/on inside an event handler resets
# the same reader state is unproven (the flight recorder stays armed to catch
# any recurrence). If lag ever appears despite this hook, cure manually with
# set -g fish_autosuggestion_enabled 0 (type a few chars)
# set -g fish_autosuggestion_enabled 1
# and save ~/.local/state/lag-triage/flight/ logs for that shell's pid.
# Respect a deliberate user choice to keep autosuggestions off.
if test "$fish_autosuggestion_enabled" != 0
set -g fish_autosuggestion_enabled 0
set -g fish_autosuggestion_enabled 1
end