Fix resize crash, add pixel scroll precision support
This commit is contained in:
parent
8301e8c905
commit
4a4db727bb
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue