Skip to content

Commit

Permalink
Fix unicode bug in LanguageLayer
Browse files Browse the repository at this point in the history
Call as bytes before slicing, that way you can take bytes that aren't
aligned to chars. Should technically also be slightly faster since you
don't have to check alignment...
  • Loading branch information
A-Walrus committed Jun 16, 2023
1 parent df09490 commit 7f74f37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ impl LanguageLayer {
&mut |byte, _| {
if byte <= source.len_bytes() {
let (chunk, start_byte, _, _) = source.chunk_at_byte(byte);
chunk[byte - start_byte..].as_bytes()
&chunk.as_bytes()[byte - start_byte..]
} else {
// out of range
&[]
Expand Down

0 comments on commit 7f74f37

Please sign in to comment.