Commit Graph

13 Commits (master)

Author SHA1 Message Date
Lena 4c85483486 Inline `format!` args wherever possible 3 months ago
cyqsimon 6a6b02117b
Apply clippy fixes (#2864)
* Apply clippy fixes

* Write changelog
3 months ago
Ethan P. 84d80eebd0
Test for correct categorization of SGR sequences
This adds a regression test for the fix in the previous commit.
4 months ago
Ethan P. 915dd9fbf8
Fix incorrect categorization of SGR sequences
Specifically, prevent other attributes from leaking into the
bold/dim/italic/underline attributes, and ensure that bright backgrounds
are put into the background attribute instead of the foreground
attribute.
4 months ago
Ethan P 1023399c5e
Remove hyperlink when wrapping lines 4 months ago
Ethan P 6549e26f5d
Re-emit hyperlinks when wrapping lines 4 months ago
Ethan P 165c495e75
Replace AnsiCodeIterator in printer.rs
This uses the new EscapeSequenceIterator, saving us a preprocessing step
for each line.
4 months ago
Ethan P 6b9b085be3
Add EscapeSequenceIterator
This is an iterator for escape sequences, using
EscapeSequenceOffsetsIterator for the underlying parsing of individual
escape sequences.
4 months ago
Ethan P 054421268f
Strip OSC sequences before printing
This commit strips OSC (Operating System Command) sequences before
printing lines. Eventually when time permits, I want to add back
support for printing OSC sequences (and improve it to treat hyperlinks
like an attribute).

Until then, this should help prevent garbled output :)
4 months ago
Ethan P 414403b062
Add EscapeSequenceOffsetsIterator
This can be used to extract a subset of ANSI escape sequences from a
string of text. I have big plans for this eventually, but for now, it'll
be used to strip OSC before printing.
4 months 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
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
Ethan P 63ad53817d
Improved ANSI passthrough (#1596)
Improve handling of ANSI passthrough. Fix ANSI passthrough for --wrap=never. Add test for ANSI passthrough.
3 years ago