Commit Graph

21 Commits (master)

Author SHA1 Message Date
einfachIrgendwer0815 3d87b25b19
Add unicode/caret replacements for all control characters (#2712) 8 months ago
David Peter 231ad86f04
Merge pull request #2502 from Enselic/clippy-1.68
Fix clippy warnings with Rust 1.68
1 year ago
einfachIrgendwer0815 8f99a78cf1
Print non-printable characters using caret notation (#2443)
When the new flag is set, non-printable characters are printed using caret notation.
1 year ago
Martin Nordholts 40a423905a Fix clippy warnings with Rust 1.68 1 year ago
Martin Nordholts 352309b056 Revert "Remove code that tries to handle ANSI escape inputs"
This reverts commit 8174e02279. Turns out
it is needed for a common use case, see
https://github.com/sharkdp/bat/issues/2307.

It is not a clean revert, because I adjust CHANGELOG.md and also add a
comment to the test. I also had to resolve a small `use` conflict.
2 years ago
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 |
2 years ago
Martin Nordholts 899fdbb347
Remove code that tries to handle ANSI escape inputs (#2189)
Syntax highlighting is broken when input contains ANSI escape characters
anyway, so there is not much point in trying to handle ANSI escapes in
input.
2 years ago
Patrick Hilhorst e7df748b6d correctly handle multiple tabs in one line 2 years ago
Patrick Hilhorst da5921b4a9 Correctly render tab stops 2 years ago
Martin Nordholts c3fc1b88fe replace_nonprintable: Keep \n around
Since it has a functional role, we can not just replace it, we must keep
it around. This also allows us to simplify the code slightly.

We must fix this before we fix #1438 since otherwise the \n will be
missing with --style=plain, since we will stop adding it if it is
missing.
4 years ago
Dash Peters 99819087f1 Switch to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet 4 years ago
sharkdp 8e18786556 Run 'cargo fmt' 4 years ago
Lzu Tao e37e9c1214 Fix some clippy lints
Some might actually improve perf
4 years ago
sharkdp 82ca8804a2 Handle non-unicode characters in the preprocessor 5 years ago
sharkdp e81f9b23e6 Fix `--show-all` for UTF-16 encoding 6 years ago
sharkdp 50dc4a79b0 Display line-feed as instead of 6 years ago
sharkdp 8fa8f44706 Use `↹` character if tab-width == 1. 6 years ago
sharkdp ecd862d9ff Feature: Highlight non-printable characters
Adds a new `-A`/`--show-all` option (in analogy to GNU Linux `cat`s option) that
highlights non-printable characters like space, tab or newline.

This works in two steps:
- **Preprocessing**: replace space by `•`, replace tab by `├──┤`, replace
newline by `␤`, etc.
- **Highlighting**: Use a newly written Sublime syntax to highlight
these special symbols.

Note: This feature is not technically a drop-in replacement for GNU `cat`s
`--show-all` but it has the same purpose.
6 years ago
eth-p d90797f8e9
Fixed tab expansion not working in --wrap=never mode. 6 years ago
eth-p b4096e5627
Moved tab expansion to happen after syntax highlighting. 6 years ago
eth-p b23ff24ebc
Added tab expansion preprocessing step. 6 years ago