aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/eat-config.el15
-rw-r--r--tests/test-term-tmux-history.el9
2 files changed, 23 insertions, 1 deletions
diff --git a/modules/eat-config.el b/modules/eat-config.el
index 425bbb5ed..317f6a63f 100644
--- a/modules/eat-config.el
+++ b/modules/eat-config.el
@@ -36,12 +36,25 @@
(hl-line-mode -1)
(display-line-numbers-mode -1))
+(defun cj/--eat-tame-scroll ()
+ "Reduce the viewport bounce from full-frame inline redraws (Claude Code).
+Such programs move the terminal cursor up to redraw their whole block and back
+to the bottom on every tick; EAT follows the cursor with point, so the window
+chases it. Line-scroll minimally instead of recentering, drop the scroll
+margin, and disable auto vscroll, so the window follows with the smallest
+movement. It cannot fully remove the bounce -- the inline redraw is the root --
+but it makes each jump gentler."
+ (setq-local scroll-conservatively 101)
+ (setq-local scroll-margin 0)
+ (setq-local auto-window-vscroll nil))
+
;; ------------------------------- eat package ---------------------------------
(use-package eat
:ensure t
:commands (eat)
- :hook (eat-mode . cj/turn-off-chrome-for-term)
+ :hook ((eat-mode . cj/turn-off-chrome-for-term)
+ (eat-mode . cj/--eat-tame-scroll))
:custom
;; Close the EAT buffer when its shell exits.
(eat-kill-buffer-on-exit t)
diff --git a/tests/test-term-tmux-history.el b/tests/test-term-tmux-history.el
index 1dbf6b0bf..13e3e1715 100644
--- a/tests/test-term-tmux-history.el
+++ b/tests/test-term-tmux-history.el
@@ -296,5 +296,14 @@ input) instead of moving Emacs point; windmove's S-arrows still reach Emacs."
(dolist (key '("S-<left>" "S-<right>"))
(should-not (eq (keymap-lookup eat-semi-char-mode-map key) #'eat-self-input))))
+(ert-deftest test-term-eat-tame-scroll-sets-minimal-scroll ()
+ "Normal: `cj/--eat-tame-scroll' sets buffer-local minimal-scroll behavior so
+the EAT window line-scrolls instead of recentering on full-frame redraws."
+ (with-temp-buffer
+ (cj/--eat-tame-scroll)
+ (should (= scroll-conservatively 101))
+ (should (= scroll-margin 0))
+ (should (null auto-window-vscroll))))
+
(provide 'test-term-tmux-history)
;;; test-term-tmux-history.el ends here