aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorNoam Postavsky2018-03-11 20:47:12 -0400
committerNoam Postavsky2018-03-13 21:58:38 -0400
commit4c33ad4a244db59bfe128aa54380904efdc775ba (patch)
tree95211f134f4c33187a4a9344b13dda2db93d0c8b /lisp
parente0f18aa07fb900c1bb0fe25386336fd6a73c9b0d (diff)
downloademacs-4c33ad4a244db59bfe128aa54380904efdc775ba.tar.gz
emacs-4c33ad4a244db59bfe128aa54380904efdc775ba.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/term.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/term.el b/lisp/term.el
index 93da33ea5b0..91eab771cf0 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -2891,9 +2891,11 @@ See `term-prompt-regexp'."
2891 ;; If the last char was written in last column, 2891 ;; If the last char was written in last column,
2892 ;; back up one column, but remember we did so. 2892 ;; back up one column, but remember we did so.
2893 ;; Thus we emulate xterm/vt100-style line-wrapping. 2893 ;; Thus we emulate xterm/vt100-style line-wrapping.
2894 (cond ((eq (term-current-column) term-width) 2894 (when (eq (term-current-column) term-width)
2895 (term-move-columns -1) 2895 (term-move-columns -1)
2896 (setq term-do-line-wrapping t))) 2896 ;; We check after ctrl sequence handling if point
2897 ;; was moved (and leave line-wrapping state if so).
2898 (setq term-do-line-wrapping (point)))
2897 (setq term-current-column nil) 2899 (setq term-current-column nil)
2898 (setq i funny)) 2900 (setq i funny))
2899 (pcase-exhaustive (and (<= ctl-end str-length) (aref str i)) 2901 (pcase-exhaustive (and (<= ctl-end str-length) (aref str i))
@@ -2993,6 +2995,9 @@ See `term-prompt-regexp'."
2993 (substring str i ctl-end))))) 2995 (substring str i ctl-end)))))
2994 ;; Ignore NUL, Shift Out, Shift In. 2996 ;; Ignore NUL, Shift Out, Shift In.
2995 ((or ?\0 #xE #xF 'nil) nil)) 2997 ((or ?\0 #xE #xF 'nil) nil))
2998 ;; Leave line-wrapping state if point was moved.
2999 (unless (eq term-do-line-wrapping (point))
3000 (setq term-do-line-wrapping nil))
2996 (if (term-handling-pager) 3001 (if (term-handling-pager)
2997 (progn 3002 (progn
2998 ;; Finish stuff to get ready to handle PAGER. 3003 ;; Finish stuff to get ready to handle PAGER.