Skip to content

make-visible not finding unsaved-editor #707

@shhyou

Description

@shhyou

Version: 8.15.0.7 [cs]

Related to: d27a480

Given this program in an unsaved editor:

#lang htdp/bsl


(check-expect 1 "no")

The source link at line 4, column 0 in the output does not highlight check-expect and does not bring up the current tab, unlike the case for a saved editor:

Welcome to DrRacket, version 8.15.0.7 [cs].
Language: htdp/bsl, with debugging; memory limit: 256 MB.
Ran 1 test.
0 tests passed.

Check failures:
        Actual value 1 differs from "no", the expected value.
at line 4, column 0
> 

It seems like this change to find-matching-tab works around the issue, but I don't know what's the right fix:

        (define/public (find-matching-tab filename)
          (define fn-path (if (string? filename)
                              (string->path filename)
                              filename))
          (for/or ([tab (in-list tabs)])
-           (define tab-filename (send (send tab get-defs) get-filename))
-           (and tab-filename
-                (pathname-equal? fn-path tab-filename)
-                tab)))
+           (cond
+             [(symbol? fn-path)
+              (and (or (send (send tab get-defs) port-name-matches? fn-path)
+                       (send (send tab get-ints) port-name-matches? fn-path))
+                   tab)]
+             [else
+              (define tab-filename (send (send tab get-defs) get-filename))
+              (and tab-filename
+                   (pathname-equal? fn-path tab-filename)
+                   tab)])))

from:

(define/public (find-matching-tab filename)
(define fn-path (if (string? filename)
(string->path filename)
filename))
(for/or ([tab (in-list tabs)])
(define tab-filename (send (send tab get-defs) get-filename))
(and tab-filename
(pathname-equal? fn-path tab-filename)
tab)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions