(completion--insert-strings): Fix up computation of
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 21 Jan 2009 21:20:55 +0000 (21:20 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 21 Jan 2009 21:20:55 +0000 (21:20 +0000)
column position which manifested e.g. in proced's signal completion.

lisp/ChangeLog
lisp/minibuffer.el

index 1275d54..2c55236 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion--insert-strings): Fix up computation of
+       column position which manifested e.g. in proced's signal completion.
+
 2009-01-21  Chong Yidong  <cyd@stupidchicken.com>
 
        * server.el (server-start): Allow server to shut down when no
@@ -19,8 +24,8 @@
 
 2009-01-20  Agustín Martín  <agustin.martin@hispalinux.es>
 
-       * textmodes/ispell.el (ispell-find-aspell-dictionaries): Use
-       aspell default dict.
+       * textmodes/ispell.el (ispell-find-aspell-dictionaries):
+       Use aspell default dict.
 
 2009-01-20  Kenichi Handa  <handa@m17n.org>
 
@@ -67,8 +72,7 @@
 
 2009-01-17  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
 
-       * textmodes/bibtex.el (bibtex-format-entry): Simplify previous
-       change.
+       * textmodes/bibtex.el (bibtex-format-entry): Simplify previous change.
 
 2009-01-17  Eli Zaretskii  <eliz@gnu.org>
 
 
 2009-01-16  Ulrich Mueller  <ulm@kph.uni-mainz.de>
 
-       * international/quail.el (quail-insert-kbd-layout): Delete
-       superfluous handling of 8-bit code.  (Bug#1418)
+       * international/quail.el (quail-insert-kbd-layout):
+       Delete superfluous handling of 8-bit code.  (Bug#1418)
 
 2009-01-16  Glenn Morris  <rgm@gnu.org>
 
        (special-display-regexps): Add customization support for
        function/other-args elements.  Rewrite doc-strings.
        (special-display-function): Rewrite doc-string.
-       (same-window-buffer-names, same-window-regexps): Minor
-       doc-string fixes.
+       (same-window-buffer-names, same-window-regexps):
+       Minor doc-string fixes.
        (special-display-p): Minor rewrite.
 
 2009-01-14  Glenn Morris  <rgm@gnu.org>
 
        Fix Bug #876:
 
-       * info.el (info-insert-file-contents, Info-insert-dir): Bind
-       inhibit-null-byte-detection to non-nil.
+       * info.el (info-insert-file-contents, Info-insert-dir):
+       Bind inhibit-null-byte-detection to non-nil.
 
 2009-01-10  Martin Rudalics  <rudalics@gmx.at>
 
 2009-01-09  Chong Yidong  <cyd@stupidchicken.com>
 
        * faces.el (face-valid-attribute-values): Use string as value for
-       :family attribute.  Now, font-family-list returns a list of
-       strings.
+       :family attribute.  Now, font-family-list returns a list of strings.
        (x-font-family-list): Obsolete compatibility version of function
        from xfaces.c.
 
 2009-01-09  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (special-display-buffer-names)
-       (special-display-regexps, special-display-function): In
-       doc-strings say "same-window" instead of "same-buffer".
+       (special-display-regexps, special-display-function):
+       In doc-strings say "same-window" instead of "same-buffer".
 
 2009-01-09  Michael Albinus  <michael.albinus@gmx.de>
 
 
 2009-01-09  Reiner Steib  <Reiner.Steib@gmx.de>
 
-       * net/imap.el (imap-enable-exchange-bug-workaround): Explain
-       auto-detection in the doc string.
+       * net/imap.el (imap-enable-exchange-bug-workaround):
+       Explain auto-detection in the doc string.
 
 2009-01-09  Juanma Barranquero  <lekktu@gmail.com>
 
index 9e762d4..c224486 100644 (file)
@@ -723,33 +723,37 @@ It also eliminates runs of equal strings."
       ;; The insertion should be "sensible" no matter what choices were made
       ;; for the parameters above.
       (dolist (str strings)
-       (unless (equal laststring str)  ; Remove (consecutive) duplicates.
+       (unless (equal laststring str) ; Remove (consecutive) duplicates.
          (setq laststring str)
-         (unless (bolp)
-            (insert " \t")
-            (setq column (+ column colwidth))
-            ;; Leave the space unpropertized so that in the case we're
-            ;; already past the goal column, there is still
-            ;; a space displayed.
-            (set-text-properties (- (point) 1) (point)
-                                 ;; We can't just set tab-width, because
-                                 ;; completion-setup-function will kill all
-                                 ;; local variables :-(
-                                 `(display (space :align-to ,column)))
-           (when (< wwidth (+ (max colwidth
-                                   (if (consp str)
-                                       (+ (string-width (car str))
-                                          (string-width (cadr str)))
-                                     (string-width str)))
-                              column))
-             (delete-char -2) (insert "\n") (setq column 0)))
-         (if (not (consp str))
-             (put-text-property (point) (progn (insert str) (point))
-                                'mouse-face 'highlight)
-           (put-text-property (point) (progn (insert (car str)) (point))
-                              'mouse-face 'highlight)
-           (put-text-property (point) (progn (insert (cadr str)) (point))
-                               'mouse-face nil)))))))
+          (let ((length (if (consp str)
+                            (+ (string-width (car str))
+                               (string-width (cadr str)))
+                          (string-width str))))
+            (unless (bolp)
+              (if (< wwidth (+ (max colwidth length) column))
+                  ;; No space for `str' at point, move to next line.
+                  (progn (insert "\n") (setq column 0))
+                (insert " \t")
+                ;; Leave the space unpropertized so that in the case we're
+                ;; already past the goal column, there is still
+                ;; a space displayed.
+                (set-text-properties (- (point) 1) (point)
+                                     ;; We can't just set tab-width, because
+                                     ;; completion-setup-function will kill all
+                                     ;; local variables :-(
+                                     `(display (space :align-to ,column)))
+                nil))
+            (if (not (consp str))
+                (put-text-property (point) (progn (insert str) (point))
+                                   'mouse-face 'highlight)
+              (put-text-property (point) (progn (insert (car str)) (point))
+                                 'mouse-face 'highlight)
+              (put-text-property (point) (progn (insert (cadr str)) (point))
+                                 'mouse-face nil))
+            ;; Next column to align to.
+            (setq column (+ column
+                            ;; Round up to a whole number of columns.
+                            (* colwidth (ceiling length colwidth))))))))))
 
 (defvar completion-common-substring nil)
 (make-obsolete-variable 'completion-common-substring nil "23.1")