Unnamed repository; edit this file 'description' to name the repository.
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.
| -rw-r--r-- | helix-core/src/movement.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index c5e2df4a..96bbd54b 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -188,7 +188,9 @@ pub(crate) enum Category { Eol, Word, Punctuation, + Unknown, } + pub(crate) fn categorize(ch: char) -> Category { if ch == '\n' { Category::Eol @@ -199,7 +201,7 @@ pub(crate) fn categorize(ch: char) -> Category { } else if ch.is_ascii_punctuation() { Category::Punctuation } else { - unreachable!("unknown '{}' character category", ch) + Category::Unknown } } |