Skip to content

Commit

Permalink
wrap option names
Browse files Browse the repository at this point in the history
  • Loading branch information
th1000s committed Apr 19, 2021
1 parent f47d040 commit 33b9c9e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
12 changes: 6 additions & 6 deletions src/features/side_by_side_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
}
Expand All @@ -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));
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions src/options/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 33b9c9e

Please sign in to comment.