From 71ecf83d63572e144d25f3389514cb0421343277 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 22 Jan 2011 17:30:08 -0600 Subject: [PATCH] delay the update of the module language's re-parsing of the editor (and re-computing the buttons) until no keys have been typed for 200 msec closes PR 11406 --- collects/drracket/private/module-language-tools.rkt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/collects/drracket/private/module-language-tools.rkt b/collects/drracket/private/module-language-tools.rkt index b925cc3c52..e4360fb184 100644 --- a/collects/drracket/private/module-language-tools.rkt +++ b/collects/drracket/private/module-language-tools.rkt @@ -88,12 +88,22 @@ (define/augment (after-delete start len) (inner (void) after-delete start len) (modification-at start)) + + (define timer #f) + (define/private (modification-at start) (when (send (send (get-tab) get-frame) initialized?) (when in-module-language? (when (or (not hash-lang-last-location) (<= start hash-lang-last-location)) - (move-to-new-language))))) + + (unless timer + (set! timer (new timer% + [notify-callback + (λ () (move-to-new-language))] + [just-once? #t]))) + (send timer stop) + (send timer start 200 #t))))) (define/private (update-in-module-language? new-one) (unless (equal? new-one in-module-language?)