summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs10
-rw-r--r--src/options/set.rs42
2 files changed, 26 insertions, 26 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 72ca762b..b2e27886 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -561,16 +561,16 @@ pub struct Opt {
#[derive(Default, Clone, Debug)]
pub struct ComputedValues {
+ pub available_terminal_width: usize,
+ pub background_color_extends_to_terminal_width: bool,
+ pub decorations_width: Width,
pub inspect_raw_lines: InspectRawLines,
pub is_light_mode: bool,
+ pub paging_mode: PagingMode,
+ pub syntax_dummy_theme: SyntaxTheme,
pub syntax_set: SyntaxSet,
pub syntax_theme: Option<SyntaxTheme>,
- pub syntax_dummy_theme: SyntaxTheme,
pub true_color: bool,
- pub available_terminal_width: usize,
- pub decorations_width: Width,
- pub background_color_extends_to_terminal_width: bool,
- pub paging_mode: PagingMode,
}
#[derive(Clone, Debug, PartialEq)]
diff --git a/src/options/set.rs b/src/options/set.rs
index e291a450..150246c9 100644
--- a/src/options/set.rs
+++ b/src/options/set.rs
@@ -467,27 +467,6 @@ fn split_feature_string(features: &str) -> impl Iterator<Item = &str> {
features.split_whitespace().rev()
}
-fn set_true_color(opt: &mut cli::Opt) {
- opt.computed.true_color = match opt.true_color.as_ref() {
- "always" => true,
- "never" => false,
- "auto" => is_truecolor_terminal(),
- _ => {
- eprintln!(
- "Invalid value for --24-bit-color option: {} (valid values are \"always\", \"never\", and \"auto\")",
- opt.true_color
- );
- process::exit(1);
- }
- };
-}
-
-fn is_truecolor_terminal() -> bool {
- env::get_env_var("COLORTERM")
- .map(|colorterm| colorterm == "truecolor" || colorterm == "24bit")
- .unwrap_or(false)
-}
-
impl FromStr for cli::InspectRawLines {
type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -562,6 +541,27 @@ fn set_widths(
background_color_extends_to_terminal_width;
}
+fn set_true_color(opt: &mut cli::Opt) {
+ opt.computed.true_color = match opt.true_color.as_ref() {
+ "always" => true,
+ "never" => false,
+ "auto" => is_truecolor_terminal(),
+ _ => {
+ eprintln!(
+ "Invalid value for --24-bit-color option: {} (valid values are \"always\", \"never\", and \"auto\")",
+ opt.true_color
+ );
+ process::exit(1);
+ }
+ };
+}
+
+fn is_truecolor_terminal() -> bool {
+ env::get_env_var("COLORTERM")
+ .map(|colorterm| colorterm == "truecolor" || colorterm == "24bit")
+ .unwrap_or(false)
+}
+
fn set_git_config_entries(opt: &mut cli::Opt, git_config: &mut git_config::GitConfig) {
// Styles
for key in &["color.diff.old", "color.diff.new"] {