Skip to content

Commit d335346

Browse files
committed
Revert overflow detection — keep only viewport pinning
The pos-visible-in-window-p based overflow detection caused multiple issues: it broke mouse scrolling by resetting the viewport position during terminal resize, and interacted badly with Emacs display state (horizontal scroll, font size changes). Remove all overflow detection code (ghostel--check-overflow, ghostel--height-adjustment). Keep the simple set-window-start pin which fixes the main issue (viewport drift with TUI apps like Claude Code). The emoji line-height issue remains open for a future fix using a different approach.
1 parent 794b5c8 commit d335346

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

ghostel.el

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,7 @@ DIR is the module directory."
548548
(defvar-local ghostel--resize-timer nil
549549
"Timer for debounced SIGWINCH on alt screen.")
550550

551-
(defvar-local ghostel--height-adjustment 0
552-
"Rows subtracted from window-body-height to fit tall lines (emoji).")
551+
553552

554553

555554
(defvar-local ghostel--last-directory nil
@@ -1715,26 +1714,10 @@ frame after idle to improve interactive responsiveness."
17151714
(ghostel--pin-window-start)))))))
17161715

17171716
(defun ghostel--pin-window-start ()
1718-
"Pin the window so terminal row 1 stays at the top.
1719-
When tall glyphs (emoji) cause content to overflow the window,
1720-
shrink the terminal by one row and re-render."
1717+
"Pin the window so terminal row 1 stays at the top."
17211718
(let ((win (get-buffer-window)))
17221719
(when win
1723-
(set-window-start win (point-min))
1724-
(when (and ghostel--term
1725-
(> (point-max) (point-min))
1726-
(not (pos-visible-in-window-p (1- (point-max)) win)))
1727-
;; Content overflows — reduce terminal by one row.
1728-
(cl-incf ghostel--height-adjustment)
1729-
(let* ((height (- (window-body-height win)
1730-
ghostel--height-adjustment))
1731-
(width (window-max-chars-per-line win)))
1732-
(when (> height 0)
1733-
(ghostel--set-size ghostel--term height width)
1734-
(when (and ghostel--process (process-live-p ghostel--process))
1735-
(set-process-window-size ghostel--process height width))
1736-
(ghostel--redraw ghostel--term ghostel-full-redraw)
1737-
(set-window-start win (point-min))))))))
1720+
(set-window-start win (point-min)))))
17381721

17391722
(defun ghostel-force-redraw ()
17401723
"Force a full terminal redraw (for debugging)."
@@ -1753,7 +1736,6 @@ PROCESS is the shell process, WINDOWS is the list of windows."
17531736
(let* ((window (car windows))
17541737
(width (window-max-chars-per-line window))
17551738
(height (window-body-height window)))
1756-
(setq ghostel--height-adjustment 0)
17571739
(when ghostel--term
17581740
(if (ghostel--mode-enabled ghostel--term 1049)
17591741
;; Alt screen: debounce the entire resize (terminal + SIGWINCH)

0 commit comments

Comments
 (0)