GNU bug report logs -
#30775
27.0.50; term.el regression handling zsh prompt - extra "%"
Previous Next
Reported by: Noam Postavsky <npostavs <at> gmail.com>
Date: Mon, 12 Mar 2018 00:43:02 UTC
Severity: normal
Tags: fixed, patch
Found in version 27.0.50
Done: Noam Postavsky <npostavs <at> gmail.com>
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 30775 in the body.
You can then email your comments to 30775 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30775
; Package
emacs
.
(Mon, 12 Mar 2018 00:43:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Noam Postavsky <npostavs <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 12 Mar 2018 00:43:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This is a regression in master (emacs-26 is ok), as reported in [1]:
when I open term or ansi-term there is always a % character at the
end of every command i execute in term.
Stated in terms of tests/lisp/term.el, the following fails:
(ert-deftest term-line-wrapping-then-motion ()
"Make sure we reset the line-wrapping state after moving cursor.
A real-life example is the default zsh prompt which writes spaces
to the end of line (triggering line-wrapping state), and then
sends a carriage return followed by another space to overwrite
the first character of the line."
(let* ((width 10)
(strs (list "x" (make-string (1- width) ?_)
"\r_")))
(should (equal (term-test-screen-from-input width 12 strs)
(make-string width ?_)))))
Patch to follow.
[1]: https://emacs.stackexchange.com/questions/39207/emacs-27-0-50-term-el-doesnt-play-well-with-zsh
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30775
; Package
emacs
.
(Mon, 12 Mar 2018 00:50:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 30775 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 30775 + patch
quit
> Patch to follow.
[v1-0001-Fix-line-wrapping-for-term.el-Bug-30775.patch (text/x-diff, inline)]
From 8b6f574ec8959891f388ca77abed908e7637a881 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sun, 11 Mar 2018 20:47:12 -0400
Subject: [PATCH v1] Fix line-wrapping for term.el (Bug#30775)
* lisp/term.el (term-emulate-terminal): Leave line-wrapping state if
point was moved after we entered it.
* test/lisp/term-tests.el (term-line-wrapping-then-motion): New test.
---
lisp/term.el | 11 ++++++++---
test/lisp/term-tests.el | 12 ++++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/lisp/term.el b/lisp/term.el
index cf7699abc9..a458cc4fe4 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -2891,9 +2891,11 @@ term-emulate-terminal
;; If the last char was written in last column,
;; back up one column, but remember we did so.
;; Thus we emulate xterm/vt100-style line-wrapping.
- (cond ((eq (term-current-column) term-width)
- (term-move-columns -1)
- (setq term-do-line-wrapping t)))
+ (when (eq (term-current-column) term-width)
+ (term-move-columns -1)
+ ;; We check after ctrl sequence handling if point
+ ;; was moved (and leave line-wrapping state if so).
+ (setq term-do-line-wrapping (point)))
(setq term-current-column nil)
(setq i funny))
(pcase-exhaustive (and (<= ctl-end str-length) (aref str i))
@@ -2993,6 +2995,9 @@ term-emulate-terminal
(substring str i ctl-end)))))
;; Ignore NUL, Shift Out, Shift In.
((or ?\0 #xE #xF 'nil) nil))
+ ;; Leave line-wrapping state if point was moved.
+ (unless (eq term-do-line-wrapping (point))
+ (setq term-do-line-wrapping nil))
(if (term-handling-pager)
(progn
;; Finish stuff to get ready to handle PAGER.
diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el
index 234dfa1f0d..8aaa61a210 100644
--- a/test/lisp/term-tests.el
+++ b/test/lisp/term-tests.el
@@ -124,6 +124,18 @@ term-test-screen-from-input
40 12 (list "\eAnSiTc /f" "oo/\n") 'default-directory)
"/foo/"))))
+(ert-deftest term-line-wrapping-then-motion ()
+ "Make sure we reset the line-wrapping state after moving cursor.
+A real-life example is the default zsh prompt which writes spaces
+to the end of line (triggering line-wrapping state), and then
+sends a carriage return followed by another space to overwrite
+the first character of the line."
+ (let* ((width 10)
+ (strs (list "x" (make-string (1- width) ?_)
+ "\r_")))
+ (should (equal (term-test-screen-from-input width 12 strs)
+ (make-string width ?_)))))
+
(provide 'term-tests)
;;; term-tests.el ends here
--
2.11.0
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 12 Mar 2018 00:50:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30775
; Package
emacs
.
(Wed, 14 Mar 2018 02:05:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 30775 <at> debbugs.gnu.org (full text, mbox):
tags 30775 fixed
close 30775
quit
Noam Postavsky <npostavs <at> gmail.com> writes:
>>From 8b6f574ec8959891f388ca77abed908e7637a881 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Sun, 11 Mar 2018 20:47:12 -0400
> Subject: [PATCH v1] Fix line-wrapping for term.el (Bug#30775)
>
> * lisp/term.el (term-emulate-terminal): Leave line-wrapping state if
> point was moved after we entered it.
> * test/lisp/term-tests.el (term-line-wrapping-then-motion): New test.
Pushed to master.
[1: 4c33ad4a24]: 2018-03-13 21:58:38 -0400
Fix line-wrapping for term.el (Bug#30775)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4c33ad4a244db59bfe128aa54380904efdc775ba
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 14 Mar 2018 02:05:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
30775 <at> debbugs.gnu.org and Noam Postavsky <npostavs <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 14 Mar 2018 02:05:02 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
.
(Wed, 11 Apr 2018 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.