emacs-diffs
[Top][All Lists]
Advanced

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

master 85f8b57: Support multi-line prompt and contents in previous-line-


From: Juri Linkov
Subject: master 85f8b57: Support multi-line prompt and contents in previous-line-or-history-element.
Date: Wed, 27 Jan 2021 13:09:37 -0500 (EST)

branch: master
commit 85f8b575001ec8c3503d7e8746862e49c0c7a3bf
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Support multi-line prompt and contents in previous-line-or-history-element.
    
    * lisp/simple.el (previous-line-or-history-element): Move to the
    beginning of minibuffer contents if there is editable minibuffer contents
    on the same line after moving point to the prompt (bug#46033).
    Fix minimal old-column from 0 to 1 to put point at the beginning of
    minibuffer contents after going to the previous history element.
---
 lisp/simple.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index c878fda..e82b138 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2472,14 +2472,24 @@ previous element of the minibuffer history in the 
minibuffer."
                                   (save-excursion
                                     (goto-char (1- prompt-end))
                                     (current-column)))
-                               0)
+                               1)
                         (current-column)))))
     (condition-case nil
        (with-no-warnings
          (previous-line arg)
           ;; Avoid moving point to the prompt
           (when (< (point) (minibuffer-prompt-end))
-            (signal 'beginning-of-buffer nil)))
+            ;; If there is minibuffer contents on the same line
+            (if (<= (minibuffer-prompt-end)
+                    (save-excursion
+                      (if (or truncate-lines (not line-move-visual))
+                          (end-of-line)
+                        (end-of-visual-line))
+                      (point)))
+                ;; Move to the beginning of minibuffer contents
+                (goto-char (minibuffer-prompt-end))
+              ;; Otherwise, go to the previous history element
+              (signal 'beginning-of-buffer nil))))
       (beginning-of-buffer
        ;; Restore old position since `line-move-visual' moves point to
        ;; the beginning of the line when it fails to go to the previous line.



reply via email to

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