Skip to content

Commit

Permalink
Interpret an invalid pager such as '' as no paging
Browse files Browse the repository at this point in the history
Fixes #386
  • Loading branch information
dandavison committed Nov 8, 2020
1 parent b149425 commit 2abec29
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/bat/output.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// https://github.com/sharkdp/bat a1b9334a44a2c652f52dddaa83dbacba57372468
// src/output.rs
// See src/bat/LICENSE
use std::env;
use std::ffi::OsString;
use std::io::{self, Write};
use std::path::PathBuf;
Expand All @@ -9,7 +10,6 @@ use std::process::{Child, Command, Stdio};
use super::less::retrieve_less_version;

use crate::config;
use crate::env;
use crate::features::navigate;

#[derive(Debug, Clone, Copy, PartialEq)]
Expand Down Expand Up @@ -49,13 +49,13 @@ impl OutputType {
let mut replace_arguments_to_less = false;

let pager_from_env = match (
env::get_env_var("DELTA_PAGER"),
env::get_env_var("BAT_PAGER"),
env::get_env_var("PAGER"),
env::var("DELTA_PAGER"),
env::var("BAT_PAGER"),
env::var("PAGER"),
) {
(Some(delta_pager), _, _) => Some(delta_pager),
(None, Some(bat_pager), _) => Some(bat_pager),
(None, None, Some(pager)) => {
(Ok(delta_pager), _, _) => Some(delta_pager),
(_, Ok(bat_pager), _) => Some(bat_pager),
(_, _, Ok(pager)) => {
// less needs to be called with the '-R' option in order to properly interpret ANSI
// color sequences. If someone has set PAGER="less -F", we therefore need to
// overwrite the arguments and add '-R'.
Expand Down

0 comments on commit 2abec29

Please sign in to comment.