diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/Naming.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/Naming.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Naming.scala b/src/compiler/scala/tools/nsc/interpreter/Naming.scala index 41ddf23de4..57f3675ada 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Naming.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Naming.scala @@ -6,6 +6,8 @@ package scala.tools.nsc package interpreter +import scala.util.Properties.lineSeparator + /** This is for name logic which is independent of the compiler (notice there's no Global.) * That includes at least generating, metaquoting, mangling, and unmangling. */ @@ -18,8 +20,14 @@ trait Naming { // <ESC> for ansi codes. val binaryChars = cleaned count (ch => ch < 32 && !ch.isWhitespace && ch != ESC) // Lots of binary chars - translate all supposed whitespace into spaces - if (binaryChars > 5) - cleaned map (ch => if (ch.isWhitespace) ' ' else if (ch < 32) '?' else ch) + // except supposed line endings, otherwise scrubbed lines run together + if (binaryChars > 5) // more than one can count while holding a hamburger + cleaned map { + case c if lineSeparator contains c => c + case c if c.isWhitespace => ' ' + case c if c < 32 => '?' + case c => c + } // Not lots - preserve whitespace and ESC else cleaned map (ch => if (ch.isWhitespace || ch == ESC) ch else if (ch < 32) '?' else ch) |