helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
31.11k stars 2.3k forks source link

Incorrect syntax highlighting with CRLF line endings #10992

Open chtenb opened 1 week ago

chtenb commented 1 week ago

Summary

It seems that some languages exhibit incorrect syntax highlighting when looking at a file with crlf line endings. I've seen this with nushell and koka, two languages I use personally.

I originally created an issue in the koka treesitter repo, but the current hypothesis seems to be that it is a generic Helix problem: https://github.com/mtoohey31/tree-sitter-koka/issues/3

Reproduction Steps

I tried this: 1. `hx` 2. Set language to koka `:set-language koka` 3. Set line endings to CRLF `:line-ending crlf` 4. Insert the following snippet ``` // Generate True with probability k/n fun gen-bool(k: int, n: int) : random bool rnd-int32(0, n) < k ``` I expected this to happen: ![image](https://github.com/helix-editor/helix/assets/1030961/49fef0af-cd66-4e14-9de3-b85d3e210218) Instead, this happened: ![image](https://github.com/helix-editor/helix/assets/1030961/ccd52148-807a-4768-9807-6df84136de83) ### Helix log _No response_ ### Platform Windows ### Terminal Emulator wezterm 20240520-135708-b8f94c47 ### Installation Method source ### Helix Version reproducible with several recent versions, including origin/master
the-mikedavis commented 1 week ago

Looks like 7ae49de (#6417) will fix this, I can't reproduce after that commit.