diff --git a/collects/redex/private/loc-wrapper-rt.rkt b/collects/redex/private/loc-wrapper-rt.rkt index caa33bea21..e3f285e9a9 100644 --- a/collects/redex/private/loc-wrapper-rt.rkt +++ b/collects/redex/private/loc-wrapper-rt.rkt @@ -58,7 +58,7 @@ [(string? e) (values line col (+ col (string-length e)))] [(symbol? e) - (values line col (+ col (string-length (symbol->string e))))] + (values line col (+ col (string-length (format "~s" e))))] [(not e) (values line col col)] [else (let loop ([lws e] diff --git a/collects/redex/tests/core-layout-test.rkt b/collects/redex/tests/core-layout-test.rkt index 62de26f24d..6e392f3e4f 100644 --- a/collects/redex/tests/core-layout-test.rkt +++ b/collects/redex/tests/core-layout-test.rkt @@ -54,6 +54,25 @@ (make-pict-token 0 1 'pict) (make-pict-token 1 0 'pict))))) +(test (replace-pict-tokens + (build-lines + '(|+1|) + (normalize-lw + (to-lw + ,(term + (|+1| x)))))) + (list (make-line 0 + (list (make-spacer-token 0 2) + (make-string-token 2 1 "(" 'roman) + (make-string-token 3 4 "+1" '(italic . roman)) + (make-string-token 7 1 " " 'roman) + (make-string-token 8 1 "x" 'swiss) + (make-string-token 9 1 ")" 'roman))) + (make-line 0 + (list (make-string-token 0 0 "" 'roman) + (make-pict-token 0 1 'pict) + (make-pict-token 1 0 'pict))))) + (test (replace-pict-tokens (build-lines '()