From: Noam Postavsky <npostavs@gmail.com>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 31193@debbugs.gnu.org
Subject: bug#31193: 26.1; error in `term-down' after window configuration change
Date: Tue, 17 Apr 2018 20:07:41 -0400 [thread overview]
Message-ID: <87muy1tm0i.fsf@gmail.com> (raw)
In-Reply-To: <7063321d07dcc711cc24699e095dfb9d@webmail.orcon.net.nz> (Phil Sainty's message of "Wed, 18 Apr 2018 01:49:20 +1200")
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
tags 31193 + patch
quit
Phil Sainty <psainty@orcon.net.nz> writes:
> On 2018-04-18 01:23, Noam Postavsky wrote:
>> Hmm, I'm not able to reproduce this, even though it makes sense to me
>> that my fix for Bug#30544 [1: a64c11a3aa] would cause this. Perhaps it
>> depends on your shell prompt as well?
>
> I do have a non-trivial prompt; but after setting PS1="$ " I still see
> the same issue, so I'm unsure whether that's a factor. My shell is
> bash.
Hmm, maybe it's a difference in bash versions? I tried adding a newline
to my prompt with PS1=$'one\ntwo$ ', but bash doesn't send the newline
after the terminal resizes. Seems it's clever enough just to redraw the
last line.
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
And since terminal-emulate-terminal doesn't receive a \n character, it
doesn't call term-down before calling (term-current-row) near the end of
that function:
(when (>= (term-current-row) term-height)
(term-handle-deferred-scroll))
So I definitely can't see how you trigger this with PS1="$ ", but
perhaps your version of bash sends a newline for some other reason? Can
you show the backtrace with PS1="$ "?
>> I think changing them to function calls, i.e., (term-current-row)
>> instead of term-current-row would be the right thing; all the other
>> term
>> functions use the function rather than accessing the variable directly.
>
> That sounds sane, and I can confirm that it fixes the problem.
Okay, here's the patch with message. Eli, should I apply this to
emacs-26? I believe it's safe because the term-current-row function
simply returns the value of the term-current-row variable if that is
non-nil. Hence it should only affect cases where we were going to
signal an error due to type-mismatch anyway.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1441 bytes --]
From c1faca2b07ac86f84450bbb95ecb6d8635410281 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Tue, 17 Apr 2018 19:17:18 -0400
Subject: [PATCH] Don't assume term-current-row cache is valid (Bug#31193)
* lisp/term.el (term-down): Call `term-current-row' instead of
directly accessing the variable `term-current-row. Following a resize
of the terminal's window, `term-current-row' is reset to nil, so it is
not safe to assume it is a number.
---
lisp/term.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/term.el b/lisp/term.el
index 0a5efa4abc..6860ea6934 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -3764,7 +3764,7 @@ term-down
(let ((start-column (term-horizontal-column)))
(when (and check-for-scroll (or term-scroll-with-delete term-pager-count))
(setq down (term-handle-scroll down)))
- (unless (and (= term-current-row 0) (< down 0))
+ (unless (and (= (term-current-row) 0) (< down 0))
(term-adjust-current-row-cache down)
(when (or (/= (point) (point-max)) (< down 0))
(setq down (- down (term-vertical-motion down)))))
@@ -3774,7 +3774,7 @@ term-down
(setq term-current-column 0)
(setq term-start-line-column 0))
(t
- (when (= term-current-row 0)
+ (when (= (term-current-row) 0)
;; Insert lines if at the beginning.
(save-excursion (term-insert-char ?\n (- down)))
(save-excursion
--
2.11.0
next prev parent reply other threads:[~2018-04-18 0:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 13:00 bug#31193: 26.1; error in `term-down' after window configuration change Phil Sainty
2018-04-17 13:23 ` Noam Postavsky
2018-04-17 13:49 ` Phil Sainty
2018-04-18 0:07 ` Noam Postavsky [this message]
2018-04-18 1:04 ` Phil Sainty
2018-04-18 2:04 ` Noam Postavsky
2018-04-18 4:23 ` Phil Sainty
2018-04-18 12:15 ` Noam Postavsky
2018-04-18 5:05 ` Phil Sainty
2018-04-18 5:37 ` Phil Sainty
2018-04-18 6:25 ` Eli Zaretskii
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=87muy1tm0i.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=31193@debbugs.gnu.org \
--cc=psainty@orcon.net.nz \
/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).