Strings exported from a module have changed line breaks
- by Jesse Millikan
In a DrScheme project, I'm using a MrEd editor-canvas% with text% and inserting a string from a literal in a Scheme file. This results in an extra blank line in the editor for each line of text I'm trying to insert.
I've tracked this down to the apparent fact that string literals from outside modules are getting extra line breaks. Here's a full example. The editor is irrelevant at this point, but it displays the result.
; test-literals.ss
(module test-literals scheme
(provide (all-defined-out))
(define exported-string "From another module
with some more
line breaks.
"))
; editor-test.ss
(module editor-test scheme
(require mred "test-literals.ss")
(define w (instantiate frame% ("Editor Test" #f) ))
(define c (instantiate editor-canvas% (w) (line-count 12) (min-width 400)))
(define editor (instantiate text% ()))
(send c set-editor editor)
(send w show #t)
(send editor erase)
(send editor insert "Some text
with
some
line
breaks.
")
(send editor insert exported-string))
And the result in the editor is
Some text
with
some
line
breaks.
From another module
with some more
line breaks.
I've traced in and figured out that it's changing Unix line breaks to Windows line breaks when strings are imported from another module, but these display as double line breaks. Why is this happening and is there a way to stop it other than changing every imported string?