[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select 77bf8e0 077/218: Fix line-wrapping for
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select 77bf8e0 077/218: Fix line-wrapping for term.el (Bug#30775) |
Date: |
Fri, 14 Dec 2018 03:35:03 -0500 (EST) |
branch: feature/gnus-select
commit 77bf8e00b7833ec0901c88057d70d73c1c96a9da
Author: Noam Postavsky <address@hidden>
Commit: Andrew G Cohen <address@hidden>
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 93da33e..91eab77 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -2891,9 +2891,11 @@ See `term-prompt-regexp'."
;; 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 @@ See `term-prompt-regexp'."
(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 234dfa1..8aaa61a 100644
--- a/test/lisp/term-tests.el
+++ b/test/lisp/term-tests.el
@@ -124,6 +124,18 @@ line6\r
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
- [Emacs-diffs] feature/gnus-select 17d92f5 031/218: Quieten compilation of some test/lisp files, (continued)
- [Emacs-diffs] feature/gnus-select 17d92f5 031/218: Quieten compilation of some test/lisp files, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 1731947 053/218: Document 'transpose-sentences' and 'transpose-paragraphs', Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 280de6e 061/218: Make compiler warn about use of obsolete hooks, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 8c08be2 058/218: * lisp/minibuffer.el (completion-cycle-threshold): Doc fix., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select f82d6e9 059/218: Revert overenthusiastic procfs fixup, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select ad8d136 054/218: Allow toggling Grep command abbreviation, and rename related symbols, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 3c8297e 066/218: ; tiny NEWS fix, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select aa527be 071/218: Replace an obsolete alias in tpu-mapper, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 16cfb9a 074/218: * lisp/progmodes/ada-mode.el (ada-clean-buffer-before-saving): Doc fix., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 29b7170 073/218: Doc fixes re obsolete items, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 77bf8e0 077/218: Fix line-wrapping for term.el (Bug#30775),
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select e274f0b 075/218: Fix some allout.el aliases, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c6e52fa 088/218: Improve robustness in tramp-sh.el, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c4bd17e 079/218: ; * test/README: Fix typo, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 4a6cf41 156/218: * doc/lispref/internals.texi (Writing Emacs Primitives): Fix grammar., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select b4377a3 164/218: Handle possible classtype values in eieio-persistent-read, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select ff16207 153/218: ; * autogen.sh: Comment., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 590166c 151/218: Firm up documentation of generalized variables, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select a3e7de9 086/218: Fix mouse-set-point when line numbers are displayed, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 57200d8 084/218: Replace "carriage-return" by "carriage return" in manuals, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 620b63a 092/218: * lisp/progmodes/verilog-mode.el (verilog-mode): Quieten compilation., Andrew G Cohen, 2018/12/14