aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorMathspy2022-06-21 16:35:25 +0000
committerGitHub2022-06-21 16:35:25 +0000
commitfa4934cff9aa5b86b907e218313a7b370962ae67 (patch)
treefa4d86079d7545f3b42b7371f9f33554ad516eb2 /helix-term/src/ui
parent9f676dab57e6421dd4c33a7ccf16e12cfb9b62cf (diff)
Default rulers color to red (#2669)
* Default rulers color to red Currently if the theme a user is using doesn't have `ui.virtual.rulers` set and they set up a ruler it just fails silently making it really hard to figure out what went wrong. Did they set incorrectly set the ruler? Are they using an outdated version of Helix that doesn't support rulers? This happened to me today, I even switched to the default theme with the assumption that maybe my theme just doesn't have the rulers setup properly and it still didn't work. Not sure if this is a good idea or not, feel free to suggest better alternatives! * Use builtin Style methods instead of Bevy style defaults Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Only default the style if there's no ui or ui.virtual * Update themes style from ui.virtual to ui.virtual.whitespace * Revert ui.virtual change in onelight theme * Prefer unwrap_or_else Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 192fa180..a8027d1b 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -20,7 +20,7 @@ use helix_core::{
use helix_view::{
document::{Mode, SCRATCH_BUFFER_NAME},
editor::{CompleteAction, CursorShapeConfig},
- graphics::{CursorKind, Modifier, Rect, Style},
+ graphics::{Color, CursorKind, Modifier, Rect, Style},
input::KeyEvent,
keyboard::{KeyCode, KeyModifiers},
Document, Editor, Theme, View,
@@ -170,7 +170,9 @@ impl EditorView {
theme: &Theme,
) {
let editor_rulers = &editor.config().rulers;
- let ruler_theme = theme.get("ui.virtual.ruler");
+ let ruler_theme = theme
+ .try_get("ui.virtual.ruler")
+ .unwrap_or_else(|| Style::default().bg(Color::Red));
let rulers = doc
.language_config()