From 17b59d60a9bf8ea266aa7794f09faa5b8d3e2157 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Mon, 13 Jul 2026 17:03:23 +0200 Subject: [PATCH] Shield ghostel buffers from global default-text-properties line-spacing/line-height text properties supplied through the default-text-properties fallback inflate rendered rows invisibly to the window-screen-lines sizing math, so the grid overcounts rows and the bottom anchor vscrolls the top lines out of view (discussion #534). Set the variable buffer-locally to nil, next to the existing line-spacing override. --- lisp/ghostel.el | 4 ++++ test/ghostel-modes-test.el | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lisp/ghostel.el b/lisp/ghostel.el index 76ea5010..ea2dae25 100644 --- a/lisp/ghostel.el +++ b/lisp/ghostel.el @@ -5018,6 +5018,10 @@ for both native and Emacs PTY paths." (setq-local truncate-lines t) (setq-local scroll-conservatively 101) (setq-local line-spacing 0) + ;; Shield row geometry from a global `default-text-properties': + ;; `line-spacing'/`line-height' properties supplied through its fallback + ;; inflate rendered rows invisibly to the `window-screen-lines' sizing math. + (setq-local default-text-properties nil) (setq-local filter-buffer-substring-function #'ghostel--filter-buffer-substring) ;; expose cwd to buffer-menu/ibuffer (setq-local list-buffers-directory (expand-file-name default-directory)) diff --git a/test/ghostel-modes-test.el b/test/ghostel-modes-test.el index 25a3b09a..d6165d6b 100644 --- a/test/ghostel-modes-test.el +++ b/test/ghostel-modes-test.el @@ -16,6 +16,25 @@ (should (member 'ghostel-default (cdr (assq 'default face-remapping-alist)))))) +(ert-deftest ghostel-test-mode-shields-default-text-properties () + "A global `default-text-properties' does not reach ghostel buffers. +Its `line-spacing'/`line-height' fallback would inflate rendered rows +invisibly to the grid sizing math (discussion #534)." + (let ((old (default-value 'default-text-properties))) + (unwind-protect + (progn + (setq-default default-text-properties + '(line-spacing 0.1 line-height 1.05)) + (with-temp-buffer + (ghostel-mode) + (should (local-variable-p 'default-text-properties)) + (should (null default-text-properties)) + (let ((inhibit-read-only t)) + (insert "x\n")) + (should (null (get-char-property (point-min) 'line-spacing))) + (should (null (get-char-property (point-min) 'line-height))))) + (setq-default default-text-properties old)))) + (ert-deftest ghostel-test-emacs-mode-preserves-point () "In Emacs mode, point stays put while the terminal keeps running. The delayed redraw path always preserves point in Emacs mode,