From d529207b0eb26b623fadf4716581add58f2cc282 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 6 Dec 2021 09:43:13 -0500 Subject: [PATCH] lisp/minibuffer.el: Fix for bug#52169 regression * 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ca82b4a9e60..21d610fdf44 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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) -- 2.39.5