summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2021-11-22 17:19:23 -0800
committerGitHub <noreply@github.com>2021-11-22 20:19:23 -0500
commit0c0043b428834e9323eaaaf5795d55209fb3dd5a (patch)
treef18e1ab1e99b513e1b722534767b98f6227e2226 /src/config.rs
parentc2743f513176cf75c0733e4752a3c90000dded1b (diff)
Navigate regexp (#782)
* Allow navigate-regexp value to be overridden. * Don't add an empty label to the navigate_regexp. * Make --hunk-label=str not require --navigate. * Change navigate regexp to navigate regex. * Turn navigate-regex into an Option<String>.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/config.rs b/src/config.rs
index 12b82945..1c28d060 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -113,7 +113,7 @@ pub struct Config {
pub minus_file: Option<PathBuf>,
pub minus_non_emph_style: Style,
pub minus_style: Style,
- pub navigate_regexp: Option<String>,
+ pub navigate_regex: Option<String>,
pub navigate: bool,
pub null_style: Style,
pub null_syntect_style: SyntectStyle,
@@ -208,8 +208,10 @@ impl From<cli::Opt> for Config {
side_by_side_data,
);
- let navigate_regexp = if opt.navigate || opt.show_themes {
- Some(navigate::make_navigate_regexp(
+ let navigate_regex = if (opt.navigate || opt.show_themes)
+ && (opt.navigate_regex.is_none() || opt.navigate_regex == Some("".to_string()))
+ {
+ Some(navigate::make_navigate_regex(
opt.show_themes,
&file_modified_label,
&file_added_label,
@@ -218,7 +220,7 @@ impl From<cli::Opt> for Config {
&hunk_label,
))
} else {
- None
+ opt.navigate_regex
};
let wrap_max_lines_plus1 = adapt_wrap_max_lines_argument(opt.wrap_max_lines);
@@ -320,7 +322,7 @@ impl From<cli::Opt> for Config {
minus_non_emph_style: styles["minus-non-emph-style"],
minus_style: styles["minus-style"],
navigate: opt.navigate,
- navigate_regexp,
+ navigate_regex,
null_style: Style::new(),
null_syntect_style: SyntectStyle::default(),
pager: opt.pager,