Commit Graph

16 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
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.
2022-08-29 18:49:29 +02:00
Patrick Hilhorst e7df748b6d correctly handle multiple tabs in one line 2022-03-06 20:03:00 +01:00
Patrick Hilhorst da5921b4a9 Correctly render tab stops 2022-03-06 20:03:00 +01:00
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.
2020-12-19 10:27:06 +01:00
Dash Peters 99819087f1 Switch to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet 2020-07-09 08:15:04 +02:00
sharkdp 8e18786556 Run 'cargo fmt' 2020-04-24 16:11:05 +02:00
Lzu Tao e37e9c1214 Fix some clippy lints
Some might actually improve perf
2020-04-24 16:11:05 +02:00
sharkdp 82ca8804a2 Handle non-unicode characters in the preprocessor 2019-08-31 20:56:53 +02:00
sharkdp e81f9b23e6 Fix `--show-all` for UTF-16 encoding 2018-11-01 22:00:47 +01:00
sharkdp 50dc4a79b0 Display line-feed as instead of 2018-11-01 22:00:47 +01:00
sharkdp 8fa8f44706 Use `↹` character if tab-width == 1. 2018-11-01 22:00:47 +01:00
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.
2018-11-01 22:00:47 +01:00
eth-p d90797f8e9
Fixed tab expansion not working in --wrap=never mode. 2018-09-11 13:45:49 -07:00
eth-p b4096e5627
Moved tab expansion to happen after syntax highlighting. 2018-09-11 13:02:22 -07:00
eth-p b23ff24ebc
Added tab expansion preprocessing step. 2018-09-10 18:11:59 -07:00