Strings exported from a module have extra line breaks
Posted
by Jesse Millikan
on Stack Overflow
See other posts from Stack Overflow
or by Jesse Millikan
Published on 2010-04-06T06:39:10Z
Indexed on
2010/04/06
7:43 UTC
Read the original article
Hit count: 284
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.
© Stack Overflow or respective owner