on master help sign in
Fix panic when moving over unicode punctuation

`is_ascii_punctuation` will only work for ASCII punctuations, and when we have unicode punctuation (or other) we jump into the `unreachable`. This patch fallback into categorizing everything in this branch as `Unknown`. Fixes https://github.com/helix-editor/helix/issues/123 https://github.com/helix-editor/helix/pull/135: add better support for unicode categories.

commit8a29086c1a1948fcfd48228f9271dd0ee90a79db authorBenoît CORTIER <benoit.cortier@fried-world.eu> dateSat 5 Jun 2021, 12:01 (5 years ago) parent16b1cfa
1 file changed+3−1
helix-core/src/movement.rs+3−1
helix-core/src/movement.rs+3−1
@@ -188,7 +188,9 @@ pub(crate) enum Category {
188188 Eol,
189189 Word,
190190 Punctuation,
191+ Unknown,
191192}
193+
192194pub(crate) fn categorize(ch: char) -> Category {
193195 if ch == '\n' {
194196 Category::Eol
@@ -199,7 +201,7 @@ pub(crate) fn categorize(ch: char) -> Category {
199201 } else if ch.is_ascii_punctuation() {
200202 Category::Punctuation
201203 } else {
202− unreachable!("unknown '{}' character category", ch)
204+ Category::Unknown
203205 }
204206}
205207