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.
This commit is contained in:
parent
2d8daac122
commit
85f8b57500
1 changed files with 12 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue