Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default rulers color to red #2669

Merged
merged 6 commits into from
Jun 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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!
  • Loading branch information
Mathspy committed Jun 12, 2022
commit 0e61a52ee357cbaa1106956eef24e308c385e5b4
17 changes: 15 additions & 2 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -170,7 +170,20 @@ impl EditorView {
theme: &Theme,
) {
let editor_rulers = &editor.config().rulers;
let ruler_theme = theme.get("ui.virtual.ruler");
let default_style = Style {
bg: Some(Color::Red),
..Default::default()
};
Mathspy marked this conversation as resolved.
Show resolved Hide resolved
let ruler_theme = theme
.try_get("ui.virtual.ruler")
.map(|style| {
if let None = style.bg {
default_style
} else {
style
}
})
Mathspy marked this conversation as resolved.
Show resolved Hide resolved
.unwrap_or(default_style);

let rulers = doc
.language_config()
Expand Down