diff options
author | Thomas Otto <th1000s@posteo.net> | 2021-04-19 22:50:51 +0200 |
---|---|---|
committer | Thomas Otto <th1000s@posteo.net> | 2021-04-19 22:53:11 +0200 |
commit | 33b9c9e749f85123fc6300f07284eef79cc6cfb6 (patch) | |
tree | 081cf2135de1a1d476f6eb82a21fc4486484e805 | |
parent | f47d040702c592f1bb6def5a8240e540dcb9184b (diff) |
wrap option names
-rw-r--r-- | src/cli.rs | 8 | ||||
-rw-r--r-- | src/config.rs | 4 | ||||
-rw-r--r-- | src/features/side_by_side_wrap.rs | 12 | ||||
-rw-r--r-- | src/options/set.rs | 4 |
4 files changed, 14 insertions, 14 deletions
@@ -468,12 +468,12 @@ pub struct Opt { /// Symbol indicating that a line has been wrapped and that the subsequent /// content is displayed right-aligned. - #[structopt(long = "side-by-side-wrap-right-symbol", default_value = "↴")] - pub side_by_side_wrap_right_symbol: String, + #[structopt(long = "side-by-side-wrap-right-wrap-symbol", default_value = "↴")] + pub side_by_side_wrap_right_wrap_symbol: String, /// Symbol displayed in front of right-aligned wrapped content. - #[structopt(long = "side-by-side-wrap-right-align-symbol", default_value = "…")] - pub side_by_side_wrap_right_align_symbol: String, + #[structopt(long = "side-by-side-wrap-right-prefix-symbol", default_value = "…")] + pub side_by_side_wrap_right_prefix_symbol: String, #[structopt(long = "file-modified-label", default_value = "")] /// Text to display in front of a modified file path. diff --git a/src/config.rs b/src/config.rs index 88538f29..f9630759 100644 --- a/src/config.rs +++ b/src/config.rs @@ -261,8 +261,8 @@ impl From<cli::Opt> for Config { truncation_symbol: format!("{}→{}", ansi::ANSI_SGR_REVERSE, ansi::ANSI_SGR_RESET), wrap_config: side_by_side_wrap::WrapConfig { wrap_symbol: opt.side_by_side_wrap_symbol, - wrap_right_symbol: opt.side_by_side_wrap_right_symbol, - right_align_symbol: opt.side_by_side_wrap_right_align_symbol, + wrap_right_wrap_symbol: opt.side_by_side_wrap_right_wrap_symbol, + wrap_right_prefix_symbol: opt.side_by_side_wrap_right_prefix_symbol, // TODO, support multi-character symbols, and thus store // right_align_symbol_len here? use_wrap_right_permille: { diff --git a/src/features/side_by_side_wrap.rs b/src/features/side_by_side_wrap.rs index 7839207f..eb293da1 100644 --- a/src/features/side_by_side_wrap.rs +++ b/src/features/side_by_side_wrap.rs @@ -14,8 +14,8 @@ use super::{line_numbers::SideBySideLineWidth, side_by_side::available_line_widt #[derive(Clone)] pub struct WrapConfig { pub wrap_symbol: String, - pub wrap_right_symbol: String, - pub right_align_symbol: String, + pub wrap_right_wrap_symbol: String, + pub wrap_right_prefix_symbol: String, // In fractions of 1000 so that a >100 wide panel can // still be configured down to a single character. pub use_wrap_right_permille: usize, @@ -165,7 +165,7 @@ where match result.last_mut() { Some(ref mut vec) if !vec.is_empty() => { - vec.last_mut().unwrap().1 = &wrap_config.wrap_right_symbol + vec.last_mut().unwrap().1 = &wrap_config.wrap_right_wrap_symbol } _ => unreachable!("wrap result must not be empty"), } @@ -181,7 +181,7 @@ where n => right_aligned_line.push((*fill_style, &SPACES[0..n])), } - right_aligned_line.push((symbol_style, &wrap_config.right_align_symbol)); + right_aligned_line.push((symbol_style, &wrap_config.wrap_right_prefix_symbol)); // skip LINEPREFIX right_aligned_line.extend(curr_line.into_iter().skip(1)); @@ -520,8 +520,8 @@ mod tests { lazy_static! { static ref TEST_WRAP_CFG: WrapConfig = WrapConfig { wrap_symbol: W.into(), - wrap_right_symbol: WR.into(), - right_align_symbol: RA.into(), + wrap_right_wrap_symbol: WR.into(), + wrap_right_prefix_symbol: RA.into(), use_wrap_right_permille: 370, max_lines: 5, }; diff --git a/src/options/set.rs b/src/options/set.rs index e94af02c..25febc0e 100644 --- a/src/options/set.rs +++ b/src/options/set.rs @@ -172,9 +172,9 @@ pub fn set_options( show_themes, side_by_side, side_by_side_wrap_max_lines, - side_by_side_wrap_right_align_symbol, + side_by_side_wrap_right_prefix_symbol, side_by_side_wrap_right_percent, - side_by_side_wrap_right_symbol, + side_by_side_wrap_right_wrap_symbol, side_by_side_wrap_symbol, tab_width, tokenization_regex, |