Skip to content

Commit

Permalink
add braille space to the list of invisible chars
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Nov 9, 2024
1 parent 57f9470 commit 3d38855
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lila/src/main/scala/StringOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ object StringOps:
// weird stuff https://www.compart.com/en/unicode/block/U+2000
(c >= '\u2028' && c <= '\u202F') ||
// Hangul fillers
(c == '\u115f' || c == '\u1160')
(c == '\u115f' || c == '\u1160') ||
// braille space https://unicode-explorer.com/c/2800
(c == '\u2800')

object normalize:

Expand Down
9 changes: 9 additions & 0 deletions lila/src/test/scala/StringOpsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ class StringTest extends munit.FunSuite:
assertEquals(normalize("keep º and ª"), "keep º and ª")
test("normalize preserve half point"):
assertEquals(normalize("½"), "½")

test("invisible chars"):
// normal space
assertEquals(softCleanUp(" "), "")
assertEquals(softCleanUp(" "), "")
// braille space
assertEquals(softCleanUp(""), "")
assertEquals(softCleanUp("⠀⠀⠀"), "")
assertEquals(softCleanUp("⠀uh⠀⠀"), "uh")

0 comments on commit 3d38855

Please sign in to comment.