diff --git a/corfu-mouse.el b/corfu-mouse.el index 2aed0a9..d5843f0 100644 --- a/corfu-mouse.el +++ b/corfu-mouse.el @@ -75,8 +75,7 @@ (defun corfu-mouse--format-candidates (fcands) "Format candidates. - -FCANDS is the return value of `corfu--format-candidates'." + FCANDS is the return value of `corfu--format-candidates'." (let ((index corfu--scroll) (cands (caddr fcands))) (while cands @@ -84,9 +83,10 @@ FCANDS is the return value of `corfu--format-candidates'." ;; Append necessary amount of spaces to make it as wide as the ;; popup. - (setq line (concat line (make-string (- (cadr fcands) - (string-width line)) - ? ))) + (let ((strlen (- (cadr fcands) (string-width line)))) + (when (> strlen 0) + (setq line (concat line (make-string strlen ? ))))) + (add-text-properties 0 (length line) `(mouse-face corfu-mouse @@ -116,6 +116,8 @@ FCANDS is the return value of `corfu--format-candidates'." "Setup mouse scrolling on BUFFER." (let ((current-buffer (current-buffer))) (with-current-buffer buffer + (when (boundp 'pixel-scroll-precision-mode) + (setq-local pixel-scroll-precision-mode nil)) (setq-local mwheel-scroll-up-function #'corfu-mouse--scroll-up) (setq-local mwheel-scroll-down-function #'corfu-mouse--scroll-down)