When pixel-scroll-precision-mode is enabled and the user scrolls up into scrollback, typing doesn't snap the view back to the prompt — the input is sent but the window stays showing scrollback.
Root cause: pixel-scroll-precision scrolls by changing Emacs's window-start and moves point upward to keep it visible. When the user types, ghostel--self-insert calls ghostel--scroll-bottom to reset the terminal's internal viewport, but point remains in the scrollback region.
The delayed redraw then sees point < viewport-start (line 2284), preserves point via saved-marker, and skips the set-window-start anchor (line 2316: (when (and vs (>= pt vs)) ...)) — intentionally, to avoid yanking scrollback readers back to the bottom. But in the scroll-on-input case, the user is done reading scrollback.
For comparison, vterm doesn't have this issue because its C module (vterm--update) controls both the terminal state and Emacs point in one call — there's no split between terminal viewport and Emacs window position.
Suggested fix: In ghostel--self-insert and ghostel--send-event, move point to the bottom after resetting the terminal viewport:
(when (and ghostel-scroll-on-input ghostel--term)
(ghostel--scroll-bottom ghostel--term)
(goto-char (point-max)) ; ← add this
(setq ghostel--force-next-redraw t))
This ensures the delayed redraw sees point in the viewport and anchors window-start correctly. The existing saved-marker logic for copy-mode and passive scrollback reading is unaffected.
When
pixel-scroll-precision-modeis enabled and the user scrolls up into scrollback, typing doesn't snap the view back to the prompt — the input is sent but the window stays showing scrollback.Root cause:
pixel-scroll-precisionscrolls by changing Emacs'swindow-startand movespointupward to keep it visible. When the user types,ghostel--self-insertcallsghostel--scroll-bottomto reset the terminal's internal viewport, butpointremains in the scrollback region.The delayed redraw then sees
point < viewport-start(line 2284), preserves point viasaved-marker, and skips theset-window-startanchor (line 2316:(when (and vs (>= pt vs)) ...)) — intentionally, to avoid yanking scrollback readers back to the bottom. But in thescroll-on-inputcase, the user is done reading scrollback.For comparison, vterm doesn't have this issue because its C module (
vterm--update) controls both the terminal state and Emacs point in one call — there's no split between terminal viewport and Emacs window position.Suggested fix: In
ghostel--self-insertandghostel--send-event, move point to the bottom after resetting the terminal viewport:This ensures the delayed redraw sees point in the viewport and anchors
window-startcorrectly. The existingsaved-markerlogic for copy-mode and passive scrollback reading is unaffected.