GNU bug report logs - #46033
up arrow in query replace should not step into the prompt

Previous Next

Package: emacs;

Reported by: reporter <laszlomail <at> protonmail.com>

Date: Fri, 22 Jan 2021 13:23:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: laszlomail--- via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: reporter <laszlomail <at> protonmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
 "46033 <at> debbugs.gnu.org" <46033 <at> debbugs.gnu.org>
Subject: Re: bug#46033: up arrow in query replace should not step into the
 prompt
Date: Sat, 23 Jan 2021 19:24:50 +0200
[Message part 1 (text/plain, inline)]
>> 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:

[avoid-minibuffer-prompt.patch (text/x-diff, inline)]
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.

This bug report was last modified 4 years and 143 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.