From 6965dfd86c4236676f41f3c79176784ad888f529 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Mon, 23 Jun 2008 22:15:22 +0000 Subject: [PATCH] Got internal error highlighting when exception source is in embedded editor. svn: r10431 --- collects/drscheme/private/rep.ss | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/collects/drscheme/private/rep.ss b/collects/drscheme/private/rep.ss index 1ce0cd1677..8e207bd188 100644 --- a/collects/drscheme/private/rep.ss +++ b/collects/drscheme/private/rep.ss @@ -707,6 +707,14 @@ TODO (srcloc-column srcloc) (srcloc-position srcloc) (srcloc-span srcloc))] + [(find-source-editor (srcloc-source srcloc) definitions-text) + => + (lambda (editor) + (make-srcloc editor + (srcloc-line srcloc) + (srcloc-column srcloc) + (srcloc-position srcloc) + (srcloc-span srcloc)))] [(unsaved-editor? (srcloc-source srcloc)) (make-srcloc (unsaved-editor-editor (srcloc-source srcloc)) (srcloc-line srcloc) @@ -766,6 +774,33 @@ TODO (when first-loc (send first-file set-caret-owner (get-focus-snip) 'global))))) + + + ;; 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))