From c15f1ea274d300feb23208324aa5b27d7274bebd Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Sat, 8 Oct 2022 21:28:42 +0300 Subject: Add cursorcolumn (#4084) * Implement cursorcolumn * Add documentation * Separate column style from line with fallback * Fallback to cursorcolumn first * Switch to non-fallback try_get_exact Add new function `try_get_exact`, which doesn't perform fallback, and use that instead because the fallback behaviour is being handled manually.--- helix-view/src/editor.rs | 3 +++ helix-view/src/theme.rs | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index d09d0ac3..60b3880c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -124,6 +124,8 @@ pub struct Config { pub line_number: LineNumber, /// Highlight the lines cursors are currently on. Defaults to false. pub cursorline: bool, + /// Highlight the columns cursors are currently on. Defaults to false. + pub cursorcolumn: bool, /// Gutters. Default ["diagnostics", "line-numbers"] pub gutters: Vec, /// Middle click paste support. Defaults to true. @@ -582,6 +584,7 @@ impl Default for Config { }, line_number: LineNumber::Absolute, cursorline: false, + cursorcolumn: false, gutters: vec![GutterType::Diagnostics, GutterType::LineNumbers], middle_click_paste: true, auto_pairs: AutoPairConfig::default(), diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index 85f5cc13..8a1f8b7e 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -277,6 +277,13 @@ impl Theme { .find_map(|s| self.styles.get(s).copied()) } + /// Get the style of a scope, without falling back to dot separated broader + /// scopes. For example if `ui.text.focus` is not defined in the theme, it + /// will return `None`, even if `ui.text` is. + pub fn try_get_exact(&self, scope: &str) -> Option