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)
|
(defun corfu-mouse--format-candidates (fcands)
|
||||||
"Format candidates.
|
"Format candidates.
|
||||||
|
FCANDS is the return value of `corfu--format-candidates'."
|
||||||
FCANDS is the return value of `corfu--format-candidates'."
|
|
||||||
(let ((index corfu--scroll)
|
(let ((index corfu--scroll)
|
||||||
(cands (caddr fcands)))
|
(cands (caddr fcands)))
|
||||||
(while cands
|
(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
|
;; Append necessary amount of spaces to make it as wide as the
|
||||||
;; popup.
|
;; popup.
|
||||||
(setq line (concat line (make-string (- (cadr fcands)
|
(let ((strlen (- (cadr fcands) (string-width line))))
|
||||||
(string-width line))
|
(when (> strlen 0)
|
||||||
? )))
|
(setq line (concat line (make-string strlen ? )))))
|
||||||
|
|
||||||
(add-text-properties 0 (length line)
|
(add-text-properties 0 (length line)
|
||||||
`(mouse-face
|
`(mouse-face
|
||||||
corfu-mouse
|
corfu-mouse
|
||||||
|
@ -116,6 +116,8 @@ FCANDS is the return value of `corfu--format-candidates'."
|
||||||
"Setup mouse scrolling on BUFFER."
|
"Setup mouse scrolling on BUFFER."
|
||||||
(let ((current-buffer (current-buffer)))
|
(let ((current-buffer (current-buffer)))
|
||||||
(with-current-buffer 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-up-function #'corfu-mouse--scroll-up)
|
||||||
(setq-local mwheel-scroll-down-function
|
(setq-local mwheel-scroll-down-function
|
||||||
#'corfu-mouse--scroll-down)
|
#'corfu-mouse--scroll-down)
|
||||||
|
|
Loading…
Reference in New Issue