unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ryan Crum <ryan@ryancrum.org>
To: 15744@debbugs.gnu.org
Subject: bug#15744: ansi-term: prompt moves to bottom of screen
Date: Mon, 28 Oct 2013 22:01:25 -0400	[thread overview]
Message-ID: <20131029020124.GC19655@cimmeria.members.linode.com> (raw)
In-Reply-To: <796BA1E8B6BA204491CEAC005F38EE50079FD5F9@EXCHMBX6.matrix.txstate.edu>

Hi,

Here's a patch that adds a variable `term-scroll-snap-to-bottom` in an attempt resolve this. It defaults to t to preserve current behavior (arguably best for curses-type interactions), but when you set it to nil it keeps your current scrolling position while typing as long as the prompt is still visible in the window.

It also works with `term-scroll-show-maximum-output` to handle cases where output is printed below the prompt (ala zsh).

This patch is against trunk.

-Ryan



*** term.el.orig	Mon Oct 28 21:53:50 2013
--- term.el	Mon Oct 28 21:53:05 2013
*************** This variable is buffer-local."
*** 551,556 ****
--- 551,564 ----
    :type 'boolean
    :group 'term)
  
+ (defcustom term-scroll-snap-to-bottom t
+   "If t, when the prompt is visible within the buffer then scroll
+ so that the prompt is on the bottom on any input or output.
+ 
+ The default is t."
+   :type 'boolean
+   :group 'term)
+ 
  (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.
*************** See `term-prompt-regexp'."
*** 3114,3128 ****
  				    (or (eq scroll 'this) (not save-point)))
  			       (and (eq scroll 'others)
  				    (not (eq selected win))))
! 		       (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)))
  		       (save-excursion
  			 (goto-char (point-max))
  			 (recenter -1)))))
--- 3122,3139 ----
  				    (or (eq scroll 'this) (not save-point)))
  			       (and (eq scroll 'others)
  				    (not (eq selected win))))
! 		       (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))
! 				(or term-scroll-snap-to-bottom
! 				    (not (pos-visible-in-window-p (point-max) win))))
  		       (save-excursion
  			 (goto-char (point-max))
  			 (recenter -1)))))







  parent reply	other threads:[~2013-10-29  2:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 19:02 bug#15744: 23.3; ansi-term: prompt moves to bottom of screen Olsen, Stuart J
2013-10-28 19:29 ` Olsen, Stuart J
2013-10-29  2:01 ` Ryan Crum [this message]
2020-08-13 11:02   ` bug#15744: " Lars Ingebrigtsen
2013-10-30 18:08 ` bug#15744: 23.3; " Olsen, Stuart J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131029020124.GC19655@cimmeria.members.linode.com \
    --to=ryan@ryancrum.org \
    --cc=15744@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).