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

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

[debbugs-tracker] bug#19824: closed (25.0.50; Support goal column in mul


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19824: closed (25.0.50; Support goal column in multi-line minibuffer)
Date: Thu, 12 Mar 2015 20:28:02 +0000

Your message dated Thu, 12 Mar 2015 22:27:14 +0200
with message-id <address@hidden>
and subject line Re: bug#19824: 25.0.50; Support goal column in multi-line 
minibuffer
has caused the debbugs.gnu.org bug report #19824,
regarding 25.0.50; Support goal column in multi-line minibuffer
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19824: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19824
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.0.50; Support goal column in multi-line minibuffer Date: Tue, 10 Feb 2015 02:45:33 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)
Tags: patch

In the single-line minibuffer the goal column was handled by using the point's
absolute position that is the same as the column on the single line.
However, this doesn't work on the multi-line minibuffer.  This patch adds
support for the goal column on multi-line input in the minibuffer:

diff --git a/lisp/simple.el b/lisp/simple.el
index 25293ed..58b4870 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1990,7 +1990,14 @@ (defun next-line-or-history-element (&optional arg)
 next element of the minibuffer history in the minibuffer."
   (interactive "^p")
   (or arg (setq arg 1))
-  (let ((old-point (point)))
+  (let* ((old-point (point))
+        ;; Remember the original goal column of possibly multi-line input
+        ;; excluding the length of the prompt on the first line.
+        (prompt-end (minibuffer-prompt-end))
+        (old-column (unless (and (eolp) (> (point) prompt-end))
+                      (if (= (line-number-at-pos) 1)
+                          (max (- (current-column) (1- prompt-end)) 0)
+                        (current-column)))))
     (condition-case nil
        (with-no-warnings
          (next-line arg))
@@ -1998,7 +2005,14 @@ (defun next-line-or-history-element (&optional arg)
        ;; Restore old position since `line-move-visual' moves point to
        ;; the end of the line when it fails to go to the next line.
        (goto-char old-point)
-       (next-history-element arg)))))
+       (next-history-element arg)
+       ;; Restore the original goal column on the last line
+       ;; of possibly multi-line input.
+       (goto-char (point-max))
+       (when old-column
+        (if (= (line-number-at-pos) 1)
+            (move-to-column (+ old-column (1- (minibuffer-prompt-end))))
+          (move-to-column old-column)))))))
 
 (defun previous-line-or-history-element (&optional arg)
   "Move cursor vertically up ARG lines, or to the previous history element.
@@ -2006,7 +2020,14 @@ (defun previous-line-or-history-element (&optional arg)
 previous element of the minibuffer history in the minibuffer."
   (interactive "^p")
   (or arg (setq arg 1))
-  (let ((old-point (point)))
+  (let* ((old-point (point))
+        ;; Remember the original goal column of possibly multi-line input
+        ;; excluding the length of the prompt on the first line.
+        (prompt-end (minibuffer-prompt-end))
+        (old-column (unless (and (eolp) (> (point) prompt-end))
+                      (if (= (line-number-at-pos) 1)
+                          (max (- (current-column) (1- prompt-end)) 0)
+                        (current-column)))))
     (condition-case nil
        (with-no-warnings
          (previous-line arg))
@@ -2014,7 +2035,15 @@ (defun previous-line-or-history-element (&optional arg)
        ;; Restore old position since `line-move-visual' moves point to
        ;; the beginning of the line when it fails to go to the previous line.
        (goto-char old-point)
-       (previous-history-element arg)))))
+       (previous-history-element arg)
+       ;; Restore the original goal column on the first line
+       ;; of possibly multi-line input.
+       (goto-char (minibuffer-prompt-end))
+       (if old-column
+          (if (= (line-number-at-pos) 1)
+              (move-to-column (+ old-column (1- (minibuffer-prompt-end))))
+            (move-to-column old-column))
+        (goto-char (line-end-position)))))))
 
 (defun next-complete-history-element (n)
   "Get next history element which completes the minibuffer before the point.



--- End Message ---
--- Begin Message --- Subject: Re: bug#19824: 25.0.50; Support goal column in multi-line minibuffer Date: Thu, 12 Mar 2015 22:27:14 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)
Done.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]