summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-04-21 09:07:36 -0400
committerThomas Otto <th1000s@posteo.net>2021-10-16 14:07:30 +0200
commit32aef48ccf6d03a1c316228b9d0398c38e22f8fc (patch)
treefff66585b1ec9f7207362ff0aedb5f9eb3229b6d /src/config.rs
parent7c93d279e60253fc380d73f2f84fe5e2a4a274e6 (diff)
Add inline-hint-style option and use for side-by-side wrap symbols
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/config.rs b/src/config.rs
index 15b3b75d..d89af7d5 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -21,7 +21,7 @@ use crate::features::side_by_side;
use crate::git_config::{GitConfig, GitConfigEntry};
use crate::paint::BgFillMethod;
use crate::style::{self, Style};
-use crate::syntect_utils;
+use crate::syntect_utils::FromDeltaStyle;
use crate::wrapping::WrapConfig;
pub const INLINE_SYMBOL_WIDTH_1: usize = 1;
@@ -84,7 +84,7 @@ pub struct Config {
pub hyperlinks: bool,
pub hyperlinks_commit_link_format: Option<String>,
pub hyperlinks_file_link_format: String,
- pub inline_hint_color: Option<SyntectStyle>,
+ pub inline_hint_style: Style,
pub inspect_raw_lines: cli::InspectRawLines,
pub keep_plus_minus_markers: bool,
pub line_fill_method: BgFillMethod,
@@ -209,6 +209,13 @@ impl From<cli::Opt> for Config {
&opt.computed.available_terminal_width,
);
+ let inline_hint_style = Style::from_str(
+ &opt.inline_hint_style,
+ None,
+ None,
+ opt.computed.true_color,
+ false,
+ );
let git_minus_style = match opt.git_config_entries.get("color.diff.old") {
Some(GitConfigEntry::Style(s)) => Style::from_git_str(s),
_ => *style::GIT_DEFAULT_MINUS_STYLE,
@@ -291,10 +298,7 @@ impl From<cli::Opt> for Config {
hyperlinks_commit_link_format: opt.hyperlinks_commit_link_format,
hyperlinks_file_link_format: opt.hyperlinks_file_link_format,
inspect_raw_lines: opt.computed.inspect_raw_lines,
- inline_hint_color: Some(SyntectStyle {
- foreground: syntect_utils::syntect_color_from_ansi_name("blue").unwrap(),
- ..SyntectStyle::default()
- }),
+ inline_hint_style,
keep_plus_minus_markers: opt.keep_plus_minus_markers,
line_fill_method: if opt.side_by_side {
// Panels in side-by-side always sum up to an even number, if the terminal has
@@ -386,6 +390,7 @@ impl From<cli::Opt> for Config {
}
},
max_lines: wrap_max_lines_plus1,
+ inline_hint_syntect_style: SyntectStyle::from_delta_style(inline_hint_style),
},
whitespace_error_style,
zero_style,