]> code.delx.au - gnu-emacs/commitdiff
Fix point motion bug in term-emulate-terminal.
authorChong Yidong <cyd@gnu.org>
Sun, 17 Jun 2012 08:26:13 +0000 (16:26 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 17 Jun 2012 08:26:13 +0000 (16:26 +0800)
* lisp/term.el (term-emulate-terminal): If term-check-size is called,
move point to the process mark without resetting point.

Fixes: debbugs:4635
lisp/ChangeLog
lisp/term.el

index 30bdefac5bf6f85ac53a94732d66c8d0463f2953..ae67fac2f4c83cd5862ba1a0570f144b3ba80d76 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-17  Chong Yidong  <cyd@gnu.org>
+
+       * term.el (term-emulate-terminal): If term-check-size is called,
+       move point to the process mark without resetting point (Bug#4635).
+
 2012-06-13  Glenn Morris  <rgm@gnu.org>
 
        * international/mule-cmds.el (mule-menu-keymap)
index e6a4bc15dd68e989e80fc59458bfc7fa78bfdefd..06bdd21a409740ab898a9a12989317a560f0e717 100644 (file)
@@ -2710,10 +2710,8 @@ See `term-prompt-regexp'."
           (str-length (length str)))
       (save-selected-window
 
-       ;; Let's handle the messages. -mm
-
-        (let* ((newstr (term-handle-ansi-terminal-messages str)))
-          (when (not (eq str newstr))
+        (let ((newstr (term-handle-ansi-terminal-messages str)))
+          (unless (eq str newstr)
            (setq handled-ansi-message t
                  str newstr)))
         (setq str-length (length str))
@@ -2723,18 +2721,19 @@ See `term-prompt-regexp'."
          (delete-region term-pending-delete-marker (process-mark proc))
          (set-marker term-pending-delete-marker nil))
 
+       (when (/= (point) (process-mark proc))
+         (setq save-point (point-marker)))
+
+       ;; Note if the window size has changed.  We used to reset
+       ;; point too, but that gives incorrect results (Bug#4635).
        (if (eq (window-buffer) (current-buffer))
            (progn
              (setq term-vertical-motion (symbol-function 'vertical-motion))
              (term-check-size proc))
          (setq term-vertical-motion
                (symbol-function 'term-buffer-vertical-motion)))
-
        (setq save-marker (copy-marker (process-mark proc)))
-
-       (when (/= (point) (process-mark proc))
-         (setq save-point (point-marker))
-         (goto-char (process-mark proc)))
+       (goto-char (process-mark proc))
 
        (save-restriction
          ;; If the buffer is in line mode, and there is a partial