GNU bug report logs - #15744
23.3; ansi-term: prompt moves to bottom of screen

Previous Next

Package: emacs;

Reported by: "Olsen, Stuart J" <stuart_olsen <at> txstate.edu>

Date: Mon, 28 Oct 2013 19:04:02 UTC

Severity: minor

Tags: confirmed, fixed, patch

Found in versions 24.3, 23.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15744 in the body.
You can then email your comments to 15744 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15744; Package emacs. (Mon, 28 Oct 2013 19:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Olsen, Stuart J" <stuart_olsen <at> txstate.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 28 Oct 2013 19:04:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Olsen, Stuart J" <stuart_olsen <at> txstate.edu>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 23.3; ansi-term: prompt moves to bottom of screen
Date: Mon, 28 Oct 2013 19:02:42 +0000
In ansi-term, once the screen has filled with output -- that is, when
the prompt for the shell is at the bottom of the window -- if one scrolls the
buffer so that the prompt is in the middle of the screen, typing
anything into the terminal buffer causes the prompt to snap back down to
the bottom of the window. This is helpful if the prompt is not in view,
but is rather obnoxious if it is, especially when using ZSH, which
displays completions and other information below the prompt, meaning
that that information is hidden once the buffer fills to the size of the
window.

To reproduce the bug, issue `emacs -Q', run the `ansi-term' command,
select an appropriate shell (I have observed this behaviour with both
GNU bash and ZSH), and issue enough commands to the shell to fill the
window. Once the window has been filled, scroll the buffer so the prompt
appears above the bottom of the window. Send any input to the shell, and
the prompt will snap to the bottom of the window.

It may be helpful to note that term.el references at line 1005 a variable
named `term-scroll-to-bottom-on-input', which does not appear to be
referenced anywhere within the code, and which is undefined in my version of
Emacs.


In GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2013-05-16 on panlong, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
configured using `configure  '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.3/leim' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Term

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x a n s i - t e r m <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> <return> 
<return> <return> <return> <return> l s <return> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> s <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> s <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
s s s s <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> M-x s u b <tab> C-g <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50slime.el (source)...
Loading /usr/share/emacs23/site-lisp/slime/slime-autoloads.elc...done
Loading /etc/emacs/site-start.d/50slime.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/usr/share/emacs/23.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.3/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.3/lisp/textmodes/flyspell

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
easymenu mml-sec password-cache mm-decode mm-bodies mm-encode mailcap
mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader
gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit
mailheader canlock sha1 hex-util hashcash mail-utils emacsbug term
disp-table ehelp electric ring slime-autoloads emacs-goodies-el
emacs-goodies-custom emacs-goodies-loaddefs easy-mmode tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind system-font-setting
font-render-setting gtk x-toolkit x multi-tty emacs)





bug Marked as found in versions 24.3. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 28 Oct 2013 19:13:01 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 28 Oct 2013 19:13:01 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 28 Oct 2013 19:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15744; Package emacs. (Mon, 28 Oct 2013 19:30:01 GMT) Full text and rfc822 format available.

Message #14 received at 15744 <at> debbugs.gnu.org (full text, mbox):

From: "Olsen, Stuart J" <stuart_olsen <at> txstate.edu>
To: "15744 <at> debbugs.gnu.org" <15744 <at> debbugs.gnu.org>
Subject: RE: 23.3; ansi-term: prompt moves to bottom of screen
Date: Mon, 28 Oct 2013 19:29:12 +0000
Additionally, sending ^L to the shell, be it bash or ZSH, causes the behaviour
to change slightly; instead of snapping the prompt to the bottom of the window
on input, the terminal snaps the prompt to the top. This behaviour persists
until the screen is again filled with output; at that point, the terminal
reverts to moving the prompt to the bottom of the screen on input.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15744; Package emacs. (Tue, 29 Oct 2013 02:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 15744 <at> debbugs.gnu.org (full text, mbox):

From: Ryan Crum <ryan <at> ryancrum.org>
To: 15744 <at> debbugs.gnu.org
Subject: Re: ansi-term: prompt moves to bottom of screen
Date: Mon, 28 Oct 2013 22:01:25 -0400
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)))))






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15744; Package emacs. (Wed, 30 Oct 2013 18:09:01 GMT) Full text and rfc822 format available.

Message #20 received at 15744 <at> debbugs.gnu.org (full text, mbox):

From: "Olsen, Stuart J" <stuart_olsen <at> txstate.edu>
To: "15744 <at> debbugs.gnu.org" <15744 <at> debbugs.gnu.org>, "ryan <at> ryancrum.org"
 <ryan <at> ryancrum.org>
Subject: RE: 23.3; ansi-term: prompt moves to bottom of screen
Date: Wed, 30 Oct 2013 18:08:08 +0000
> Here's a patch [...]

Thank you, that works absolutely beautifully.



Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 12 Aug 2020 22:38:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15744; Package emacs. (Thu, 13 Aug 2020 11:04:02 GMT) Full text and rfc822 format available.

Message #25 received at 15744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ryan Crum <ryan <at> ryancrum.org>
Cc: 15744 <at> debbugs.gnu.org
Subject: Re: bug#15744: ansi-term: prompt moves to bottom of screen
Date: Thu, 13 Aug 2020 13:02:59 +0200
Ryan Crum <ryan <at> ryancrum.org> writes:

> 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.

Thanks; the patch still seems to work fine against Emacs 28, so I've
applied it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 11:04:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 15744 <at> debbugs.gnu.org and "Olsen, Stuart J" <stuart_olsen <at> txstate.edu> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 11:04:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.