bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#46033: up arrow in query replace should not step into the prompt


From: Juri Linkov
Subject: bug#46033: up arrow in query replace should not step into the prompt
Date: Sat, 23 Jan 2021 19:24:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> This is a feature: it allows you to scroll through the text shown in
>> the minibuffer, in case you want to edit it. Use M-p to go directly
>> to the previous history.
>
> I understand it's a feature, but as you see in the picture the prompt is
> empty, and the full default replacement is visible.
>
> In this case arrow should retrieve the previous history, instead of going
> into the prompt, because there is nothing to scroll.

Thanks for the well justified request.  This patch avoids moving point
to the prompt on the rightful assumption that most of the time the users
would not want to edit read-only text:

diff --git a/lisp/simple.el b/lisp/simple.el
index 0355ac863a..f5fe366f69 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2476,7 +2476,10 @@ previous-line-or-history-element
                         (current-column)))))
     (condition-case nil
        (with-no-warnings
-         (previous-line arg))
+         (previous-line arg)
+          ;; Avoid moving point to the prompt
+          (when (< (point) (minibuffer-prompt-end))
+            (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]