]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix column double counting in term.el (Bug#31662)
authorJohn Shahid <jvshahid@gmail.com>
Thu, 31 May 2018 03:55:16 +0000 (23:55 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sat, 2 Jun 2018 03:06:34 +0000 (23:06 -0400)
* lisp/term.el (term-emulate-terminal): Invalidate
`term-current-column' after deleting overwritten text.

lisp/term.el
test/lisp/term-tests.el

index 19e68ddb49eff527aa78be5a5fefe625fa43d72e..715f39bbbfcd1b7d9d1545593016760724e0167d 100644 (file)
@@ -2904,7 +2904,8 @@ See `term-prompt-regexp'."
                   (when (not (or (eobp) term-insert-mode))
                     (let ((pos (point)))
                       (term-move-columns columns)
-                      (delete-region pos (point))))
+                      (delete-region pos (point))
+                      (setq term-current-column nil)))
                   ;; In insert mode if the current line
                   ;; has become too long it needs to be
                   ;; chopped off.
index 8aaa61a210b9d1d1381043d6c4fc1fbf10e78337..72a9ad1ef7493c0e212733133084dd2b0b7b71e4 100644 (file)
@@ -89,6 +89,13 @@ first line\r_next line\r\n"))
                                               "\e[2;1Hc"
                                               "\e[1;2Hb"
                                               "\e[1;1Ha") "" t))))
+  (should (equal "abcde    j"
+                 (term-test-screen-from-input
+                  10 12 '("abcdefghij"
+                          "\e[H"  ;move back to point-min
+                          "abcde"
+                          "    j"))))
+
   ;; Relative positioning.
   (should (equal "ab\ncd"
                  (term-test-screen-from-input