Closed imsuck closed 12 months ago
This is because you're using the reversed modifier on the cursor.
But why aren't they working like other characters?
Oh I see, this is happening because whitespace and indent guides are rendered on top of highlights like cursor colors in the rendering code. So the ui.cursor
fg color is overridden by the ui.virtual.whitespace
fg color.
I'm not sure if this is related but rulers also act weirdly.
What causes the ui.virtual.whitespace
to have a higher precedence than the ui.cursor
scope? If it's not too involved, I could attempt a PR fix.
This is even more problematic if you set the indent guide and the cursor to ▏
. If you are in insert mode and at the place of an indentation guidelines, the cursor became invisible.
[editor.cursor-shape]
insert = "bar"
[editor.indent-guides]
render = true
character = "▏"
Here the cursor at the begin of the statement
Here is the cursor at the level of the indent guide at the left:
Continued in https://github.com/helix-editor/helix/issues/8909 (indent guides) and https://github.com/helix-editor/helix/issues/7371 (rulers). The whitespace case was fixed in https://github.com/helix-editor/helix/pull/8879
Summary
Even if you set the cursor's foreground and the reverse modifier, it would still change its color if it was on a virtual whitespace or indent guide. Which is not expected since on normal text it stays white.
theme.toml to replicate
```toml "ui.selection" = { bg = "gray" } "ui.cursor" = { fg = "light-gray", modifiers = ["reversed"] } "ui.virtual.indent-guide" = { fg = "blue" } "ui.virtual.whitespace" = { fg = "blue" } ```Reproduction Steps
I tried this: [![asciicast](https://asciinema.org/a/79vFx0OJmmdrp6qEDhalNGeKL.svg)](https://asciinema.org/a/79vFx0OJmmdrp6qEDhalNGeKL) I expected this to happen: Whitespaces and indent guides should respect the cursor's foreground, and the cursor should stay white. Instead, this happened: The cursor changes its color. Note: I use gray `▏` indent guides. And my selection bg has the same color. Which makes it hard to tell which side is the selection anchor on is if it was on the `▏`. I used blue for the asciinema just to make it stand out. ### Helix log Since this is a theme related problem logs wouldn't be useful. I still left it here just in case.~/.cache/helix/helix.log
``` 2023-01-24T12:29:59.292 helix_view::editor [ERROR] Failed to initialize the LSP for `source.toml` { cannot find binary path } 2023-01-24T12:40:28.317 helix_view::editor [ERROR] Failed to initialize the LSP for `source.bash` { cannot find binary path } 2023-01-24T13:35:50.586 helix_view::editor [ERROR] editor error: 1 unsaved buffer(s) remaining: ["hyprland.conf"] 2023-01-24T20:15:58.854 helix_view::editor [ERROR] editor error: No definition found. 2023-01-24T20:19:57.833 helix_view::editor [ERROR] editor error: No definition found. 2023-01-25T05:57:24.824 helix_view::editor [ERROR] Failed to initialize the LSP for `source.bash` { cannot find binary path } 2023-01-25T05:59:36.373 helix_view::editor [ERROR] Failed to initialize the LSP for `source.bash` { cannot find binary path } 2023-01-25T06:46:01.835 helix_view::editor [ERROR] editor error: No more matches 2023-01-25T08:36:37.703 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 6, character: 71 }, end: Position { line: 6, character: 71 } }, severity: Some(Error), code: None, code_description: None, source: Some("rustc"), message: "expected `;`, found `}`", related_information: Some([DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/imsuck/Yes/amogus/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 7, character: 0 }, end: Position { line: 7, character: 1 } } }, message: "unexpected token" }, DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/imsuck/Yes/amogus/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 6, character: 71 }, end: Position { line: 6, character: 71 } } }, message: "add `;` here: `;`" }]), tags: None, data: Some(Object {"rendered": String("error: expected `;`, found `}`\n --> src/main.rs:7:72\n |\n7 | let (h, m) = (h.parse::