From ec9f83e17500ccd3c4ce5b2a6291d46e50c78665 Mon Sep 17 00:00:00 2001 From: Bogdan Popa Date: Fri, 13 Oct 2023 15:38:00 +0300 Subject: [PATCH] FranzCross,mixin: fix context selection on Windows when scrolled --- FranzCross/mixin.rkt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/FranzCross/mixin.rkt b/FranzCross/mixin.rkt index 9915314..69a4eeb 100644 --- a/FranzCross/mixin.rkt +++ b/FranzCross/mixin.rkt @@ -98,9 +98,15 @@ (define item-height (quotient (send receiver get-height) - (send receiver number-of-visible-items))) + (add1 (send receiver number-of-visible-items)))) + (define y-pos + (let ([y (send event get-y)]) + (case (system-type 'os) + [(windows) ;; does not include scroll offset + (+ y (* item-height (send receiver get-first-visible-item)))] + [else y]))) (define item-index - (let* ([index (quotient (send event get-y) item-height)] + (let* ([index (quotient y-pos item-height)] [index (case (system-type 'os) [(macosx) index] ;; the first non-header row has y=0 [else (sub1 index)])])