Skip to content

Commit

Permalink
Merge pull request #595 from eed3si9n/bport/replace-literally
Browse files Browse the repository at this point in the history
[1.2.x] Avoid regex in UsedName for the common case of names without newlines
  • Loading branch information
jvican authored Sep 7, 2018
2 parents 335878c + 6f909dc commit 932472b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ object UsedName {
}

private def escapeControlChars(name: String) = {
name.replaceAllLiterally("\n", "\u26680A")
if (name.indexOf('\n') > 0) // optimize for common case to regex overhead
name.replaceAllLiterally("\n", "\u26680A")
else
name
}
}

0 comments on commit 932472b

Please sign in to comment.