summaryrefslogtreecommitdiff
path: root/lisp/term.el
diff options
context:
space:
mode:
authorRyan Crum <ryan@ryancrum.org>2020-08-13 13:02:17 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-13 13:02:17 +0200
commitc84d3c1638a140b3ca16e8285328a903e16aa27e (patch)
tree4eaa4610aab721d86438f9913b57f333d0d03e5c /lisp/term.el
parent53720a9bdedaf75eebf199897740561a4040b5c4 (diff)
downloademacs-c84d3c1638a140b3ca16e8285328a903e16aa27e.tar.gz
emacs-c84d3c1638a140b3ca16e8285328a903e16aa27e.tar.bz2
emacs-c84d3c1638a140b3ca16e8285328a903e16aa27e.zip
Add a new variable to not recenter term on all input
* lisp/term.el (term-scroll-snap-to-bottom): New variable (bug#15744). * lisp/term.el (term-emulate-terminal): Use it.
Diffstat (limited to 'lisp/term.el')
-rw-r--r--lisp/term.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/term.el b/lisp/term.el
index b990c83cfcb..6f899fcb5c8 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -501,6 +501,13 @@ This variable is buffer-local."
:type 'boolean
:group 'term)
+(defcustom term-scroll-snap-to-bottom t
+ "Control whether to keep the prompt at the bottom of the window.
+If non-nil, when the prompt is visible within the window, then
+scroll so that the prompt is on the bottom on any input or
+output."
+ :type 'boolean)
+
(defcustom term-scroll-show-maximum-output nil
"Controls how interpreter output causes window to scroll.
If non-nil, then show the maximum output when the window is scrolled.
@@ -3108,15 +3115,19 @@ See `term-prompt-regexp'."
(or (eq scroll 'this) (not save-point)))
(and (eq scroll 'others)
(not (eq selected win))))
- (goto-char term-home-marker)
- (recenter 0)
+ (when term-scroll-snap-to-bottom
+ (goto-char term-home-marker)
+ (recenter 0))
(goto-char (process-mark proc))
(if (not (pos-visible-in-window-p (point) win))
(recenter -1)))
;; Optionally scroll so that the text
;; ends at the bottom of the window.
(when (and term-scroll-show-maximum-output
- (>= (point) (process-mark proc)))
+ (>= (point) (process-mark proc))
+ (or term-scroll-snap-to-bottom
+ (not (pos-visible-in-window-p
+ (point-max) win))))
(save-excursion
(goto-char (point-max))
(recenter -1)))))