From b0095111d4816043891138c3d36568d220c2db4a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 5 Jan 2011 06:59:02 -0700 Subject: [PATCH] restore and document scrolling behavior Closes PR 11583, and everts the previous fix for PR 10853 and fixes it in a different way --- collects/drracket/private/unit.rkt | 14 ++++++-------- collects/mred/private/wxme/editor-canvas.rkt | 10 +++++----- collects/scribblings/gui/editor-admin-class.scrbl | 6 +++++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/collects/drracket/private/unit.rkt b/collects/drracket/private/unit.rkt index 7720df615b..4ef50ada9a 100644 --- a/collects/drracket/private/unit.rkt +++ b/collects/drracket/private/unit.rkt @@ -2909,14 +2909,12 @@ module browser threading seems wrong. (define (set-visible-regions txt regions) (when regions (for-each (λ (canvas region) - (send canvas call-as-primary-owner - (λ () - (let ([admin (send txt get-admin)]) - (send admin scroll-to - (first region) - (second region) - (third region) - (fourth region)))))) + (set-visible-region canvas + (first region) + (second region) + (third region) + (fourth region) + #f)) (send txt get-canvases) regions))) diff --git a/collects/mred/private/wxme/editor-canvas.rkt b/collects/mred/private/wxme/editor-canvas.rkt index e72232430b..a12cbeeba5 100644 --- a/collects/mred/private/wxme/editor-canvas.rkt +++ b/collects/mred/private/wxme/editor-canvas.rkt @@ -1131,17 +1131,17 @@ (define/public (do-scroll-to localx localy w h refresh? bias prev? next? only-focus?) (and canvas - (or (and (or (send canvas is-focus-on?) - (not only-focus?)) - (list (send canvas scroll-to localx localy w h refresh? bias))) - (and (not (send canvas is-focus-on?)) + (or (and (not (send canvas is-focus-on?)) (or (and prev? prevadmin (send prevadmin do-scroll-to localx localy w h refresh? bias #t #f #t)) (and next? nextadmin - (send nextadmin do-scroll-to localx localy w h refresh? bias #f #t #t))))))) + (send nextadmin do-scroll-to localx localy w h refresh? bias #f #t #t)))) + (and (or (not only-focus?) + (send canvas is-focus-on?)) + (list (send canvas scroll-to localx localy w h refresh? bias)))))) (def/override (grab-caret [(symbol-in immediate display global) dist]) (when canvas diff --git a/collects/scribblings/gui/editor-admin-class.scrbl b/collects/scribblings/gui/editor-admin-class.scrbl index 6da0ea487a..2c395347fd 100644 --- a/collects/scribblings/gui/editor-admin-class.scrbl +++ b/collects/scribblings/gui/editor-admin-class.scrbl @@ -273,8 +273,12 @@ The @scheme[bias] argument is one of: The return value is @scheme[#t] if the @techlink{display} is scrolled, @scheme[#f] if not (either because the requested region is already visible, because the @techlink{display} has zero size, or because the - editor is currently printing.) + editor is currently printing). +If an editor has multiple @techlink{displays}, then if any display + currently has the keyboard focus, it is scrolled. Otherwise, the + ``primary owner'' of the editor (see @method[editor-canvas% + call-as-primary-owner]) is scrolled. } @methimpl{