From 216aee244f5c0fe826643618c3889d2ee83c5bb1 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 31 Aug 2011 22:14:09 -0500 Subject: [PATCH] adjust drracket so that it copies the definitions text before evaluating it this means that various things that try to color and otherwise show info by changing the way the editor looks no longer need to worry about whether it is locked and delay things in some complicated way. also, this means that users can edit while drracket is running the program which is hopefully less confusing. --- collects/drracket/private/syncheck/gui.rkt | 1 + collects/drracket/private/unit.rkt | 29 ++++++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/collects/drracket/private/syncheck/gui.rkt b/collects/drracket/private/syncheck/gui.rkt index 8555ecf944..5bdb6b7db1 100644 --- a/collects/drracket/private/syncheck/gui.rkt +++ b/collects/drracket/private/syncheck/gui.rkt @@ -1711,6 +1711,7 @@ If the namespace does not, they are colored the unbound color. (define module-language? (is-a? (drracket:language-configuration:language-settings-language settings) drracket:module-language:module-language<%>)) + (send definitions-text-copy set-style-list (send definitions-text get-style-list)) ;; speeds up the copy (send definitions-text copy-self-to definitions-text-copy) (with-lock/edit-sequence definitions-text-copy diff --git a/collects/drracket/private/unit.rkt b/collects/drracket/private/unit.rkt index 547643f8ea..a2565c26b4 100644 --- a/collects/drracket/private/unit.rkt +++ b/collects/drracket/private/unit.rkt @@ -1146,12 +1146,10 @@ module browser threading seems wrong. (define/public-final (set-i _i) (set! i _i)) (define/public (disable-evaluation) (set! enabled? #f) - (send defs lock #t) (send ints lock #t) (send frame disable-evaluation-in-tab this)) (define/public (enable-evaluation) (set! enabled? #t) - (send defs lock #f) (send ints lock #f) (send frame enable-evaluation-in-tab this)) (define/public (get-enabled) enabled?) @@ -2647,23 +2645,16 @@ module browser threading seems wrong. (send interactions-text reset-console) (send interactions-text clear-undos) - (let ([start 0]) - (send definitions-text split-snip start) - (let* ([name (send definitions-text get-port-name)] - [text-port (open-input-text-editor definitions-text start 'end values name #t)]) - (port-count-lines! text-port) - (let* ([line (send definitions-text position-paragraph start)] - [column (- start (send definitions-text paragraph-start-position line))] - [relocated-port (relocate-input-port text-port - (+ line 1) - column - (+ start 1))]) - (port-count-lines! relocated-port) - (send interactions-text evaluate-from-port - relocated-port - #t - (λ () - (send interactions-text clear-undos)))))))) + (define name (send definitions-text get-port-name)) + (define defs-copy (new text%)) + (send defs-copy set-style-list (send definitions-text get-style-list)) ;; speeds up the copy + (send definitions-text copy-self-to defs-copy) + (define text-port (open-input-text-editor defs-copy 0 'end values name #t)) + (send interactions-text evaluate-from-port + text-port + #t + (λ () + (send interactions-text clear-undos))))) (inherit revert save) (define/private (check-if-save-file-up-to-date)