diff --git a/src/output.rs b/src/output.rs index 539ea645..c79535c3 100644 --- a/src/output.rs +++ b/src/output.rs @@ -73,7 +73,7 @@ impl OutputType { // // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER // or bats '--pager' command line option. - let replace_arguments_to_less = pager.source == PagerSource::PagerEnvVar; + let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager; if args.is_empty() || replace_arguments_to_less { p.arg("--RAW-CONTROL-CHARS"); diff --git a/src/pager.rs b/src/pager.rs index 947f522d..c99d2994 100644 --- a/src/pager.rs +++ b/src/pager.rs @@ -8,10 +8,10 @@ pub(crate) enum PagerSource { Config, /// From the env var BAT_PAGER - BatPagerEnvVar, + EnvVarBatPager, /// From the env var PAGER - PagerEnvVar, + EnvVarPager, /// No pager was specified, default is used Default, @@ -93,8 +93,8 @@ pub(crate) fn get_pager(config_pager: Option<&str>) -> Result, Par let (cmd, source) = match (config_pager, &bat_pager, &pager) { (Some(config_pager), _, _) => (config_pager, PagerSource::Config), - (_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::BatPagerEnvVar), - (_, _, Ok(pager)) => (pager.as_str(), PagerSource::PagerEnvVar), + (_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::EnvVarBatPager), + (_, _, Ok(pager)) => (pager.as_str(), PagerSource::EnvVarPager), _ => ("less", PagerSource::Default), }; @@ -106,11 +106,11 @@ pub(crate) fn get_pager(config_pager: Option<&str>) -> Result, Par // 'more' and 'most' does not supports colors; automatically use 'less' instead // if the problematic pager came from the generic PAGER env var let no_color_support = kind == PagerKind::More || kind == PagerKind::Most; - let use_less_instead = no_color_support && source == PagerSource::PagerEnvVar; + let use_less_instead = no_color_support && source == PagerSource::EnvVarPager; Ok(Some(if use_less_instead { let no_args = vec![]; - Pager::new("less", &no_args, PagerKind::Less, PagerSource::PagerEnvVar) + Pager::new("less", &no_args, PagerKind::Less, PagerSource::EnvVarPager) } else { Pager::new(bin, args, kind, source) }))