From 1126bc66a517383d016cba0bfc673d1449025dfa Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Thu, 7 Dec 2023 11:49:09 +0100 Subject: corfu--in-region: Expand first before computing candidates for cycling --- corfu.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/corfu.el b/corfu.el index 16aeb37..8f40a7f 100644 --- a/corfu.el +++ b/corfu.el @@ -854,16 +854,16 @@ or if the last invoked command is not listed in (when exit (funcall exit str 'finished)) t) (`(,newstr . ,newpt) - (let* ((state (corfu--recompute str pt table pred)) + (unless (markerp beg) (setq beg (copy-marker beg))) + (setq end (copy-marker end t) + completion-in-region--data (list beg end table pred)) + (unless (equal str newstr) + (corfu--replace beg end newstr)) + (goto-char (+ beg newpt)) + (let* ((state (corfu--recompute newstr newpt table pred)) (base (alist-get 'corfu--base state)) (total (alist-get 'corfu--total state)) (candidates (alist-get 'corfu--candidates state))) - (unless (markerp beg) (setq beg (copy-marker beg))) - (setq end (copy-marker end t) - completion-in-region--data (list beg end table pred)) - (unless (equal str newstr) - (corfu--replace beg end newstr)) - (goto-char (+ beg newpt)) (if (= total 1) ;; If completion is finished and cannot be further completed, ;; return 'finished. Otherwise setup the Corfu popup. -- cgit v1.0