From fc50be1caaa47ee315269b7254a742b4717b8350 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 5 Aug 2011 23:33:51 -0500 Subject: [PATCH] when moving the insertion point due to a search, use call-as-primary-owner to scroll the right editor closes PR 12080 --- collects/framework/private/frame.rkt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/collects/framework/private/frame.rkt b/collects/framework/private/frame.rkt index b8cd67689a..55d61f65f8 100644 --- a/collects/framework/private/frame.rkt +++ b/collects/framework/private/frame.rkt @@ -1959,10 +1959,12 @@ #f)] [found (λ (text first-pos) - (let* ([last-pos ((if (eq? searching-direction 'forward) + -) - first-pos (string-length string))] - [start-pos (min first-pos last-pos)] - [end-pos (max first-pos last-pos)]) + (define (thunk) + (define last-pos ((if (eq? searching-direction 'forward) + -) + first-pos (string-length string))) + (define start-pos (min first-pos last-pos)) + (define end-pos (max first-pos last-pos)) + (send text begin-edit-sequence) (send text set-caret-owner #f 'display) (send text set-position start-pos end-pos #f #f 'local) @@ -1994,9 +1996,14 @@ end-pos start-pos)))) - (send text end-edit-sequence) - - #t))]) + (send text end-edit-sequence)) + + (define owner (or (send text get-active-canvas) + (send text get-canvas))) + (if owner + (send owner call-as-primary-owner thunk) + (thunk)) + #t)]) (if (string=? string "") (not-found top-searching-edit #t)