-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thread 'main' panicked at 'internal error: entered unreachable code', helix-core/src/movement.rs:203:9 #123
Comments
Oh boy, here we go again. At least it wasn't a regression. I'll go look at this tomorrow and hopefully fix it the same day. |
It's categorize not handling UTF-8: https://github.com/helix-editor/helix/blob/master/helix-core/src/movement.rs#L202 Kakoune falls back to categorizing everything as punctuation: https://github.com/mawww/kakoune/blob/master/src/unicode.hh#L123 |
It's not fully correct to do that, but it should work with movement since we usually don't care about the category, just whether two characters fit in the same category. |
I wonder how can we handle these A quick hack to let others aware of that. I saw that as well, the unreachable but I thought it is safe. Oh, I accidentally commited to master branch. helix/helix-core/src/movement.rs Line 202 in 6254720
|
I think for the time being we could just match Kakoune and fallback to punctuation, that way there's at least no panic. For categorization I saw https://docs.rs/unicode_categories/0.1.1/unicode_categories/index.html but it doesn't seem maintained much |
I would go for the kakoune approach because I don't really see what else we could get in that |
`is_ascii_punctuation` will only work for ASCII punctuations, and when we have unicode punctuation we jump into the `unreachable`. This patch fallback into categorizing everything in this branch as punctuation (kakoune approach). Fixes helix-editor#123
I don't think that'll be a problem, since it doesn't look like it's something that needs to be maintained since it's more or less complete. I'll look into integrating it and leave #129 as a fallback, though I'm curious as to what you mean by us not usually caring about the category while moving? Edit: |
I think I found a good solution using this crate: use unicode_general_category::{GeneralCategory, get_general_category};
fn main() {
const TEST_CASE: &'static str = ".,!?;:。、!?;:";
for chr in TEST_CASE.chars() {
assert_eq!(get_general_category(chr), GeneralCategory::OtherPunctuation);
}
assert_eq!(get_general_category('お'), GeneralCategory::OtherPunctuation); // Fails
} |
`is_ascii_punctuation` will only work for ASCII punctuations, and when we have unicode punctuation we jump into the `unreachable`. This patch fallback into categorizing everything in this branch as punctuation (kakoune approach). Fixes helix-editor#123
`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 helix-editor#123 helix-editor#135: add better support for unicode categories.
I'm running on commit 407b37c
I got this error when writing some Japanese text in my buffer. Issue is likely with the character
。
. I changed code to display the character, here is the full trace:UPDATE: it happens when moving using commands like
b
,e
orw
with various unicode characters (another one is…
).The text was updated successfully, but these errors were encountered: