emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 ee909aa: * lisp/simple.el (next-line-or-history-e


From: Juri Linkov
Subject: [Emacs-diffs] emacs-25 ee909aa: * lisp/simple.el (next-line-or-history-element): Reset temporary-goal-column.
Date: Wed, 10 Feb 2016 00:31:52 +0000

branch: emacs-25
commit ee909aa2bb3c30eb3b842426088a32a4504a0d0d
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/simple.el (next-line-or-history-element): Reset 
temporary-goal-column.
    
    (previous-line-or-history-element): Reset temporary-goal-column.
    Use end-of-visual-line instead of line-end-position.  (Bug#22544)
---
 lisp/simple.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index cfdea74..e39c864 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2041,6 +2041,10 @@ next element of the minibuffer history in the 
minibuffer."
        ;; the end of the line when it fails to go to the next line.
        (goto-char old-point)
        (next-history-element arg)
+       ;; Reset `temporary-goal-column' because a correct value is not
+       ;; calculated when `next-line' above fails by bumping against
+       ;; the bottom of the minibuffer (bug#22544).
+       (setq temporary-goal-column 0)
        ;; Restore the original goal column on the last line
        ;; of possibly multi-line input.
        (goto-char (point-max))
@@ -2071,6 +2075,10 @@ previous element of the minibuffer history in the 
minibuffer."
        ;; the beginning of the line when it fails to go to the previous line.
        (goto-char old-point)
        (previous-history-element arg)
+       ;; Reset `temporary-goal-column' because a correct value is not
+       ;; calculated when `previous-line' above fails by bumping against
+       ;; the top of the minibuffer (bug#22544).
+       (setq temporary-goal-column 0)
        ;; Restore the original goal column on the first line
        ;; of possibly multi-line input.
        (goto-char (minibuffer-prompt-end))
@@ -2078,7 +2086,15 @@ previous element of the minibuffer history in the 
minibuffer."
           (if (= (line-number-at-pos) 1)
               (move-to-column (+ old-column (1- (minibuffer-prompt-end))))
             (move-to-column old-column))
-        (goto-char (line-end-position)))))))
+        ;; Put the cursor at the end of the visual line instead of the
+        ;; logical line, so the next `previous-line-or-history-element'
+        ;; would move to the previous history element, not to a possible upper
+        ;; visual line from the end of logical line in `line-move-visual' mode.
+        (end-of-visual-line)
+        ;; Since `end-of-visual-line' puts the cursor at the beginning
+        ;; of the next visual line, move it one char back to the end
+        ;; of the first visual line (bug#22544).
+        (unless (eolp) (backward-char 1)))))))
 
 (defun next-complete-history-element (n)
   "Get next history element which completes the minibuffer before the point.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]