Upgrade "time" (and its dependency chain rooted at "plist"), the previous
version did not build with 1.80.
Tell the new 'unexpected_cfgs' lint that 'tarpaulin_include' is okay
Mark one clippy lint as a false positive
Tell clap to not wrap output, append `after_long_help()` (with matching
ansi codes in this section), then manually wrap the result.
The help output is now paginated if writing to a terminal.
All code paths flow back to main(), so an invoked pager is properly
waited for (by the OutputType drop impl).
Use new, smaller PagerCfg instead of the full Config, as for
pager output only 3 variables are relevant.
oneshot_write() can be used to write paginated output, usually
before exiting.
--max-line-length increased to 3000, highlighting now stops after 400
characters. In that case the highlighting may be incorrect until it
is reset for the next hunk.
Document that the input of `truncate_str()` may be cut on a double width
char ("fullwidth") - then the output is no longer a prefix of the input.
`truncate_str_short()` could be faster by not constructing the result and
instead only returning an index, but it will be used in rare edge cases so
reusing existing logic is good enough.
Common code moved to `truncate_str_impl()`.
Assume (with fallback) that graphemes are at most 2 wide.
Fewer allocations.
Tests.
Sets `LESSUTFCHARDEF` (unless already present), a new env var introduced
by this less version to always print characters from the Private Use Area
of Unicode as-is, even if the terminal does not understand them.
* Update terminal-colorsaurus to 0.4.0
* Update `terminal-colorsaurus` with bugfix
> * 🐛 Fixed `OSC 11` response being visible to users of GNU Screen
by detecting Screen and erroring before sending any control sequences (bash/terminal-colorsaurus#16).
* Update `terminal-colorsaurus` to 0.4.3
This simplifies the call sites.
Also skip updating if the path is already absolute, and handle
'/dev/null' on Windows so it is no longer converted to '\dev\null'.
Insta makes writing new tests or performing changes which update the
expected value(s) easier. The new reference data can be reviewed
and inserted/updated automatically by `cargo insta review` (after
`cargo install cargo-insta`, but that tool is optional).
The snapshots are stored inline using the `@""` syntax and not in
separate files because the delta test output is small and designed to
be human readable.
See https://insta.rs/#hello-snapshot-testing
and https://docs.rs/insta/1.39.0/insta/
* Fix unused variables
* Don't read git files when --no-gitconfig is given
Despite starting delta with `--no-gitconfig`, strace still shows
that `.git/config` etc. files are accessed. By no longer doing
that it is very clear that no config options are read from there.
`env::set_var` is not-yet-unsafe, and here tests fail
because a var is already set by a second test while the first one
is still running.
`cargo test -- test_env` with sufficient (auto detected) parallelism
triggers this.
* Fix clippy warnings
* Repair --default-language, and highlight using full filename
Fixed that the "txt" fallback was used instead of --default-language
And when looking for syntax highlighting, keep the filename around
as long as possible.
Using simple custom logic (filename > 4) a Makefile can be highlighted
with make syntax, but a 'cc' or 'ini' file does not get treated like
a *.cc or *.ini file.
Currently the underlying highlighting lib syntect and the sublime syntax
definitions can not make this distinction
(<http://www.sublimetext.com/docs/syntax.html>).
Fix a regression introduced by feec45b (Fix warning highlight for
trailing whitespace (#1037), 2023-05-17) where trailing space at the end
of an unchanged token is highlighted if the token follows an insertion.
This happens because when the token is split in two to separate trailing
whitespace the two halves end up being tagged with different edit
operations. This can be seen in the test changes in
`test_infer_edits_14` and `test_infer_edits_16` introduced by feec45b
which changed the operation from `PlusNoop` to `Insertion` when
splitting trailing whitespace from unchanged tokens. Fix this by using
the same operation when adding both halves of a split token and
correcting the tests.
Fixes#1658
* Simplify handle_grep_line via early return
Rather than indenting the entire body of the function twice, return
early if the conditions aren't met.
* Parse filename unambiguously using color escape sequences
`git grep`, by default, emits ANSI color escape sequences around the
filename, separator, and line number. Parse these if available.
This currently assumes the default colors, and will fall back to the
previous parsing if any of the colors have been changed.
Add tests for filenames that previously failed to parse correctly.