From: Juri Linkov Date: Thu, 20 Aug 2020 23:21:26 +0000 (+0300) Subject: * lisp/simple.el (previous-line-or-history-element): Handle logical lines. X-Git-Tag: emacs-28.0.90~6484 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4c5043c50b52e404c211c18da8cd59a2ee86253d;p=emacs.git * lisp/simple.el (previous-line-or-history-element): Handle logical lines. When 'line-move-visual' is nil, use 'end-of-line' to move point to the end of the first logical line (bug#42862) Thanks to Michael Welsh Duggan . --- diff --git a/lisp/simple.el b/lisp/simple.el index f08015372af..b106d4b0ba7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2416,15 +2416,17 @@ previous element of the minibuffer history in the minibuffer." (goto-char (1- (minibuffer-prompt-end))) (current-column)))) (move-to-column old-column)) - ;; Put the cursor at the end of the visual line instead of the - ;; logical line, so the next `previous-line-or-history-element' - ;; would move to the previous history element, not to a possible upper - ;; visual line from the end of logical line in `line-move-visual' mode. - (end-of-visual-line) - ;; Since `end-of-visual-line' puts the cursor at the beginning - ;; of the next visual line, move it one char back to the end - ;; of the first visual line (bug#22544). - (unless (eolp) (backward-char 1))))))) + (if (not line-move-visual) ; Handle logical lines (bug#42862) + (end-of-line) + ;; Put the cursor at the end of the visual line instead of the + ;; logical line, so the next `previous-line-or-history-element' + ;; would move to the previous history element, not to a possible upper + ;; visual line from the end of logical line in `line-move-visual' mode. + (end-of-visual-line) + ;; Since `end-of-visual-line' puts the cursor at the beginning + ;; of the next visual line, move it one char back to the end + ;; of the first visual line (bug#22544). + (unless (eolp) (backward-char 1)))))))) (defun next-complete-history-element (n) "Get next history element that completes the minibuffer before the point.