Commit Graph

9 Commits

Author SHA1 Message Date
David Peter 48541b8507 Fix clippy suggestions
Leads to a performance improvement for `bat -A`:

    | Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
    |:---|---:|---:|---:|---:|
    | `./bat-master --no-config -A ./bat-master` | 259.8 ± 1.1 | 258.4 | 261.7 | 1.15 ± 0.01 |
    | `./bat-2301 --no-config -A ./bat-master` | 225.6 ± 1.8 | 224.0 | 229.5 | 1.00 |
2022-09-04 14:28:44 +02:00
Nathan Fisher 5114c0189d
Add support for BusyBox less as pager (#2162)
* Add support for BusyBox less as pager

* Run tests/syntax-tests/update.sh to update tests

* Address reviewer's concerns with pull request
* Revert all changes in `test` directory
* Minimize overall diff size
* Detect busybox from separate helper function
* Pass equivalent options to BusyBox from same code by changing from long to
  short options

* Remove redundant `if` statement from previous commit
Add test for invalid utf-8
Add `parse_less_version_busybox` to test for invalid program
Add commenting around short options
2022-05-04 07:56:38 +02:00
Marcin Puc 372e42f350 Reduce nesting in if blocks by short circuiting 2021-09-12 15:50:10 +02:00
David Peter bf2b2df9c9 Fix for Windows: do not run binaries from CWD
This fixes a bug on Windows where `Command::new` would also run
executables from the current working directory, possibly resulting in
accidental runs of programs called `less`.
2021-07-12 23:17:30 +02:00
Allen Wild 91a347bf6d Fix less version parsing for minor versions of less
Less 581.2 is here, and it has a ".2" in the version string, which can't
be parsed as a usize.

Update the check to find a non-digit character rather than a space. This
ignores the minor version, but parses the major version correctly.
2021-05-12 11:47:16 +02:00
Ethan P 025c5c061b Make less version check accept a path to the less binary 2021-02-16 09:11:27 +01:00
David Tolnay 014d754588 Move paging support behind a feature 2020-03-31 09:27:56 +02:00
sharkdp 8d0b8a227b Add test for less 529 2019-12-23 13:01:14 +01:00
sharkdp 67fe804256 Do not pass '--no-init' on newer less versions
With this change, we do not pass the `--no-init` option in newer
versions of less (530 or higher).

This fixes #749
2019-12-23 12:45:23 +01:00