You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppress spurious SIGWINCH on minibuffer-induced window shrink
When the minibuffer opens (M-x, vertico, consult, etc.), Emacs shrinks
the window displaying the terminal, triggering
window-configuration-change-hook → set-process-window-size and thus
SIGWINCH to the shell. Closing the minibuffer sends a second one.
Fish repaints its whole prompt on SIGWINCH; complex TUIs redraw the
full screen. Both are jarring no-ops from the user's perspective.
Solution: treat minibuffer-induced height shrinks as crops, matching
how a normal buffer behaves when the minibuffer steals space — the
bottom rows are simply hidden, no signal is sent. When the minibuffer
closes and the window grows back, the size matches the committed PTY
size, so no signal is sent either.
Refinements to keep the cropping correct:
- Only crop while the terminal is on the *primary* screen. Apps on
the alternate screen buffer (vim, htop, less, Claude Code) own the
full viewport and need SIGWINCH to re-layout for the smaller window.
New Zig binding `ghostel--alt-screen-p' checks DEC modes
1049/1047/47 in one native call.
- If the user switches focus into the ghostel window while the
minibuffer is still open, commit the current (smaller) size so the
shell/app knows its real viewport — they are now actively using it.
Handled by `ghostel--commit-cropped-size' hooked into
window-selection-change-functions.
- Track `ghostel--term-cols' alongside `ghostel--term-rows' so no-op
resizes (window merely moves) are skipped.
Module version bumped to 0.17.0 for the new export.
env.bindFunction("ghostel--set-palette", 2, 2, &fnSetPalette, "Set the ANSI color palette.\n\n(ghostel--set-palette TERM COLORS-STRING)");
43
43
env.bindFunction("ghostel--set-default-colors", 3, 3, &fnSetDefaultColors, "Set default foreground and background colors.\n\n(ghostel--set-default-colors TERM FG-HEX BG-HEX)");
44
44
env.bindFunction("ghostel--mode-enabled", 2, 2, &fnModeEnabled, "Return t if terminal DEC private MODE is enabled.\n\n(ghostel--mode-enabled TERM MODE)");
45
+
env.bindFunction("ghostel--alt-screen-p", 1, 1, &fnAltScreen, "Return t if terminal is on the alternate screen buffer.\n\n(ghostel--alt-screen-p TERM)");
45
46
env.bindFunction("ghostel--cursor-position", 1, 1, &fnCursorPosition, "Return terminal cursor position as (COL . ROW), 0-indexed.\n\n(ghostel--cursor-position TERM)");
46
47
env.bindFunction("ghostel--cursor-pending-wrap-p", 1, 1, &fnCursorPendingWrap, "Return t if the cursor is in pending-wrap state.\n\n(ghostel--cursor-pending-wrap-p TERM)");
47
48
env.bindFunction("ghostel--debug-state", 1, 1, &fnDebugState, "Return debug info about terminal/render state.\n\n(ghostel--debug-state TERM)");
0 commit comments