]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/minibuffer.el: Fix for bug#52169 regression
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 Dec 2021 14:43:13 +0000 (09:43 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 Dec 2021 14:43:13 +0000 (09:43 -0500)
* lisp/minibuffer.el (completion-table-subvert): Make sure we return
a boundary that's not outside of the limit of the string.

lisp/minibuffer.el

index ca82b4a9e60df719a954467ed00477af37261e78..21d610fdf44d3e0ebfb1508f6847c0d02f3ac1ed 100644 (file)
@@ -283,8 +283,9 @@ the form (concat S2 S)."
          ((eq (car-safe action) 'boundaries)
           (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
             `(boundaries
-              ,(max (length s1)
-                    (+ beg (- (length s1) (length s2))))
+              ,(min (length string)
+                    (max (length s1)
+                         (+ beg (- (length s1) (length s2)))))
               . ,(and (eq (car-safe res) 'boundaries) (cddr res)))))
          ((stringp res)
           (if (string-prefix-p s2 res completion-ignore-case)