From: Juri Linkov <juri@linkov.net>
To: reporter <laszlomail@protonmail.com>
Cc: "46033@debbugs.gnu.org" <46033@debbugs.gnu.org>
Subject: bug#46033: up arrow in query replace should not step into the prompt
Date: Wed, 27 Jan 2021 20:10:14 +0200 [thread overview]
Message-ID: <871re62qvr.fsf@mail.linkov.net> (raw)
In-Reply-To: <871re9x7jn.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 25 Jan 2021 19:14:52 +0200")
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
>>> This is exactly what the patch does. Have you really tried it?
>>
>> Yes, I don't know what happened (I applied it manually), but I
>> must have made an error, because it didn't work.
>>
>> Then I checked the original code and I came up with the same
>> solution you did.
>>
>> So, yes, it does work. Thanks, and sorry for the confusion.
>
> Thanks for confirming, now this is fixed.
Actually, this is not so simple. Currently this doesn't work with
multi-line minibuffer. When there is non-prompt text on the previous line,
it should move point to the editable portion of that line. So I pushed
this patch that supports not only multi-line minibuffer contents,
but also multi-line prompts.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: previous-line-or-history-element.patch --]
[-- Type: text/x-diff, Size: 1282 bytes --]
diff --git a/lisp/simple.el b/lisp/simple.el
index c878fdab92..680bfd7f43 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2472,14 +2472,24 @@ previous-line-or-history-element
(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.
next prev parent reply other threads:[~2021-01-27 18:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 13:21 bug#46033: up arrow in query replace should not step into the prompt laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-22 13:55 ` Eli Zaretskii
2021-01-22 14:16 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 17:24 ` Juri Linkov
2021-01-23 17:46 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:34 ` Juri Linkov
2021-01-23 18:53 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-25 17:14 ` Juri Linkov
2021-01-27 18:10 ` Juri Linkov [this message]
2021-01-22 18:44 ` Lars Ingebrigtsen
2021-01-22 18:52 ` Eli Zaretskii
2021-01-23 17:35 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:17 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:30 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:33 ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871re62qvr.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=46033@debbugs.gnu.org \
--cc=laszlomail@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.