From caa1699264e583d9703dd47e6162c6386775915f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 27 Dec 2021 17:55:23 +0800 Subject: [PATCH] Fix precision scrolling inside terminal buffers * lisp/term.el (term-goto-process-mark-maybe): Don't move point to process mark if the event is a vertical wheel event. --- lisp/term.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index e0a2f0a9a4b..5961350ff9e 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -3300,13 +3300,16 @@ Called as a buffer-local `post-command-hook' function in `term-char-mode' to prevent commands from putting the buffer into an inconsistent state by unexpectedly moving point. -Mouse events are ignored so that mouse selection is unimpeded. +Mouse and wheel events are ignored so that mouse selection and +mouse wheel scrolling is unimpeded. Only acts when the pre-command position of point was equal to the process mark, and the `term-char-mode-point-at-process-mark' option is enabled. See `term-set-goto-process-mark'." (when term-goto-process-mark - (unless (mouse-event-p last-command-event) + (unless (or (mouse-event-p last-command-event) + (memq (event-basic-type last-command-event) + '(wheel-down wheel-up))) (goto-char (term-process-mark))))) (defun term-process-mark () -- 2.39.2