From 20e1a1590c17e042bf21f7a41a690303cb7b9fd1 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 17:33:54 -0700 Subject: [PATCH] modern.out: if there are non-whitespace characters, perhaps after editing, turn them into whitespace. fixs a bug like this when trying to rename CONSTANT: CONSTANT: a 1 ; CONSTANT: b 1 ; -> CONSTANT: a 1 ; CONSTANT: b 1 --- core/modern/out/out.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/modern/out/out.factor b/core/modern/out/out.factor index aca7a46bbe..5a03449da1 100644 --- a/core/modern/out/out.factor +++ b/core/modern/out/out.factor @@ -4,13 +4,17 @@ USING: accessors combinators combinators.short-circuit combinators.smart continuations fry io io.encodings.utf8 io.files io.streams.string kernel modern modern.paths modern.slices multiline namespaces prettyprint sequences sets -splitting strings arrays ; +splitting strings arrays unicode ; IN: modern.out symbol: last-slice +: replace-whitespace ( string -- string' ) + [ dup blank? [ drop char: \s ] unless ] map ; + : write-whitespace ( obj -- ) - [ last-slice get [ swap slice-between ] [ slice-before ] if* io:write ] + ! [ last-slice get [ swap slice-between ] [ slice-before ] if* io:write ] + [ last-slice get [ swap slice-between replace-whitespace io:write ] [ drop ] if* ] [ last-slice namespaces:set ] bi ; defer: write-literal