Skip to content

Commit

Permalink
fix String.softCleanup removes \n (\u000A)
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 15, 2024
1 parent 7807dcf commit 14b52f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lila/src/main/scala/StringOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ object StringOps:
private val invisibleChars: Set[Int] =
// blankcopypaste.com
val blankcopypaste = Set('\u00A0', '\u2000', '\u2001', '\u2002', '\u2004', '\u2005', '\u2006', '\u2007',
'\u2008', '\u2009', '\u200A', '\u2028', '\u205F', '\u3000', '\u2003', '\u25A0', '\u0009', '\u000A',
'\u000C', '\u001C', '\u200B', '\u200C', '\u2060', '\u2061', '\u2062', '\u00AD', '\u034F', '\u061C',
'\u115F', '\u1160', '\u17B4', '\u17B5', '\u180B', '\u180C', '\u180D', '\u180E', '\u200D', '\u200E',
'\u200F', '\u202A', '\u202B', '\u202C', '\u202D', '\u202E', '\u202F', '\u2063', '\u2064', '\u2064',
'\u2066', '\u2066', '\u2067', '\u2068', '\u2069', '\u206A', '\u2800', '\u206B', '\u206C', '\u206D',
'\u206E', '\u206F', '\u3164', '\uFFFC', '\uFEFF', '\uFFA0')
'\u2008', '\u2009', '\u200A', '\u2028', '\u205F', '\u3000', '\u2003', '\u25A0', '\u0009', '\u000C',
'\u001C', '\u200B', '\u200C', '\u2060', '\u2061', '\u2062', '\u00AD', '\u034F', '\u061C', '\u115F',
'\u1160', '\u17B4', '\u17B5', '\u180B', '\u180C', '\u180D', '\u180E', '\u200D', '\u200E', '\u200F',
'\u202A', '\u202B', '\u202C', '\u202D', '\u202E', '\u202F', '\u2063', '\u2064', '\u2064', '\u2066',
'\u2066', '\u2067', '\u2068', '\u2069', '\u206A', '\u2800', '\u206B', '\u206C', '\u206D', '\u206E',
'\u206F', '\u3164', '\uFFFC', '\uFEFF', '\uFFA0')
// invisible chars https://www.compart.com/en/unicode/block/U+2000
val invisible = Set('\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', '\u2007',
'\u2008', '\u2009', '\u200A', '\u200B', '\u200C', '\u200D', '\u200E', '\u200F')
Expand Down
5 changes: 5 additions & 0 deletions lila/src/test/scala/StringOpsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ class StringTest extends munit.FunSuite:
assertEquals(sc("󠀁"), "")
assertEquals(sc("󠀠"), "")
assertEquals(sc("󠀰"), "")
assertEquals(
sc("""multi
line"""),
"multi\nline"
)

0 comments on commit 14b52f9

Please sign in to comment.