Skip to content

Commit

Permalink
Check that selected window doesn't change during completion (Fix #277)
Browse files Browse the repository at this point in the history
I am not sure if this change also fixes other edge cases of #112.
  • Loading branch information
minad committed Dec 23, 2022
1 parent d524a0c commit 948f712
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions corfu.el
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,11 @@ See `corfu-separator' for more details."
(defun corfu--continue-p ()
"Continue completion?"
(pcase-let ((pt (point))
(buf (current-buffer))
(`(,beg ,end . ,_) completion-in-region--data))
(and beg end
(eq (marker-buffer beg) (current-buffer))
(eq buf (marker-buffer beg))
(eq buf (window-buffer))
;; Check ranges
(<= beg pt end)
(save-excursion
Expand Down Expand Up @@ -1180,7 +1182,7 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED."
(defun corfu--auto-tick ()
"Return the current tick/status of the buffer.
Auto completion is only performed if the tick did not change."
(list (current-buffer) (buffer-chars-modified-tick) (point)))
(list (selected-window) (current-buffer) (buffer-chars-modified-tick) (point)))

;;;###autoload
(define-minor-mode corfu-mode
Expand Down

0 comments on commit 948f712

Please sign in to comment.