From d6ee81feba9233430514b87d52ad7a5171946696 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Mon, 23 Jun 2008 22:15:35 +0000 Subject: [PATCH] Making separate find-syntax-source-editor file. svn: r10432 --- collects/drscheme/private/debug.ss | 4 ++- .../private/find-syntax-source-editor.ss | 30 +++++++++++++++++++ collects/drscheme/private/rep.ss | 28 ++--------------- 3 files changed, 35 insertions(+), 27 deletions(-) create mode 100644 collects/drscheme/private/find-syntax-source-editor.ss diff --git a/collects/drscheme/private/debug.ss b/collects/drscheme/private/debug.ss index 3fca8ff589..f20fa1f1cf 100644 --- a/collects/drscheme/private/debug.ss +++ b/collects/drscheme/private/debug.ss @@ -16,6 +16,7 @@ profile todo: scheme/gui/base string-constants framework/private/bday + "find-syntax-source-editor.ss" "drsig.ss" "bindings-browser.ss" (for-syntax scheme/base)) @@ -775,7 +776,8 @@ profile todo: [(and frame (is-a? frame frame:editor<%>)) (send frame get-editor)] [else #f])] - [(is-a? debug-source editor<%>) debug-source])] + [(is-a? debug-source editor<%>) debug-source] + [else #f])] [rep (and (is-a? frame drscheme:unit:frame%) (send frame get-interactions-text))]) (when frame diff --git a/collects/drscheme/private/find-syntax-source-editor.ss b/collects/drscheme/private/find-syntax-source-editor.ss new file mode 100644 index 0000000000..a2fc378c3c --- /dev/null +++ b/collects/drscheme/private/find-syntax-source-editor.ss @@ -0,0 +1,30 @@ +#lang scheme/base +(require scheme/class + framework + scheme/gui/base) + +(provide find-syntax-source-editor) + +;; find-syntax-source-editor: syntax-source text% -> (or/c editor #f) +;; Looks for an embedded snip editor whose source is the a-stx-source. +;; +;; Note: this is a copy-and-paste from syncheck. +;; I've ripping out the editor caches for now, +;; until I get comments from others about this. +(define (find-syntax-source-editor a-stx-source defs-text) + (let txt-loop ([text defs-text]) + (cond + [(and (is-a? text text:basic<%>) + (send text port-name-matches? a-stx-source)) + text] + [else + (let snip-loop ([snip (send text find-first-snip)]) + (cond + [(not snip) + #f] + [(and (is-a? snip editor-snip%) + (send snip get-editor)) + (or (txt-loop (send snip get-editor)) + (snip-loop (send snip next)))] + [else + (snip-loop (send snip next))]))]))) \ No newline at end of file diff --git a/collects/drscheme/private/rep.ss b/collects/drscheme/private/rep.ss index 8e207bd188..1f95c4be4f 100644 --- a/collects/drscheme/private/rep.ss +++ b/collects/drscheme/private/rep.ss @@ -26,6 +26,7 @@ TODO scheme/unit scheme/list "drsig.ss" + "find-syntax-source-editor.ss" string-constants setup/xref scheme/gui/base @@ -707,7 +708,7 @@ TODO (srcloc-column srcloc) (srcloc-position srcloc) (srcloc-span srcloc))] - [(find-source-editor (srcloc-source srcloc) definitions-text) + [(find-syntax-source-editor (srcloc-source srcloc) definitions-text) => (lambda (editor) (make-srcloc editor @@ -776,31 +777,6 @@ TODO - ;; find-source-editor: syntax-source text% -> (or/c editor #f) - ;; Looks for an embedded snip editor whose source is the a-stx-source. - ;; - ;; Note: this is a copy-and-paste from syncheck. - ;; I've ripping out the editor caches for now, - ;; until I get comments from others about this. - (define/private (find-source-editor a-stx-source defs-text) - (let txt-loop ([text defs-text]) - (cond - [(and (is-a? text text:basic<%>) - (send text port-name-matches? a-stx-source)) - text] - [else - (let snip-loop ([snip (send text find-first-snip)]) - (cond - [(not snip) - #f] - [(and (is-a? snip editor-snip%) - (send snip get-editor)) - (or (txt-loop (send snip get-editor)) - (snip-loop (send snip next)))] - [else - (snip-loop (send snip next))]))]))) - - (define/public (reset-highlighting) (reset-error-ranges))