adjust the completions box so that it doesn't raise the error mentioned in 12396 anymore

closes PR 12396

original commit: 081dc6c9a1f67862af6a8ae2d7dfcafb21afe686
This commit is contained in:
Robby Findler 2011-11-26 16:34:26 -06:00
parent 49d4593939
commit c0ffac2972

View File

@ -3791,14 +3791,15 @@ designates the character that triggers autocompletion
;; handle-mouse-movement : int int -> bool
;; takes an editor coordinate, returns whether it has intercept
(define/public (handle-mouse-movement x y)
(let*-values ([(mx my w h) (get-menu-coordinates)])
(when (and (<= mx x (+ mx w))
(< (+ my menu-padding-y)
y
(+ my (vector-length (geometry-mouse->menu-item-vector geometry)))))
(set! highlighted-menu-item (vector-ref (geometry-mouse->menu-item-vector geometry)
(inexact->exact (- y my))))
(redraw))))
(define-values (mx my w h) (get-menu-coordinates))
(define index (floor (inexact->exact (- y my))))
(when (and (<= mx x (+ mx w))
(< menu-padding-y
index
(vector-length (geometry-mouse->menu-item-vector geometry))))
(set! highlighted-menu-item (vector-ref (geometry-mouse->menu-item-vector geometry)
index))
(redraw)))
;; get-current-selection : -> string
;; returns the selected string