1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-12 19:18:24 +02:00
Commit Graph

29 Commits

Author SHA1 Message Date
Andrew Gallant
ab1b877c20
termcolor: release 0.3.5 2018-02-20 20:15:08 -05:00
Markus Westerlind
597bf04a56 termcolor: add ?Sized bound for &mut T impl 2018-02-20 07:13:37 -05:00
Balaji Sivaraman
c78ab9e669 termcolor: improve "intense" docs
Fixes #797
2018-02-20 07:11:25 -05:00
Balaji Sivaraman
d57fc58081 termcolor: add underline support
This commit adds underline support to the termcolor crate, and
exposes it through ripgrep.

Fixes #798
2018-02-20 07:10:03 -05:00
Andrew Gallant
5d15f49f0c
termcolor: release 0.3.4 2018-02-11 13:39:12 -05:00
Andrew Gallant
2d68054b1d termcolor: support ANSI in Windows terminals
This commit uses the new virtual terminal processing feature in Windows 10
to enable the use of ANSI escape codes to color ripgrep's output. This
technique is preferred over the console APIs because it seems like where
the future is heading, but also because it avoids needing to use an
intermediate buffer to deal with the Windows console in a multithreaded
environment.
2018-02-10 22:28:12 -05:00
Andrew Gallant
7e5589f07d termcolor: permit hex colors
This commit adds support for specifying Ansi256 or RGB colors using
hexadecimal notation.
2018-02-10 22:28:12 -05:00
Marc Tiehuis
a8543f798d termcolor: add extended color support
This commit adds 256-color and 24-bit truecolor support to ripgrep.
This only provides output support on ANSI terminals. If the Windows
console is used for coloring, then 256-color and 24-bit color settings
are ignored.
2018-01-29 18:49:50 -05:00
kennytm
8514d4fbb4 termcolor: tweak reset escape
Write `Ansi::reset()` using `\x1b[0m` instead of `\x1b[m`.

This works around an AppVeyor bug: https://github.com/appveyor/ci/issues/1824
2018-01-29 14:14:55 -05:00
Balaji Sivaraman
b6177f0459 cleanup: replace try! with ? 2018-01-01 09:22:35 -05:00
Shubham Lagwankar
f4770c2094 Fix typos 2017-10-21 22:38:01 -04:00
Andrew Gallant
12a78a992c
termcolor-0.3.3 2017-08-27 11:05:55 -04:00
Andrew Gallant
d97c80be63 termcolor: make StandardStream be Send
This commit fixes a bug where the `StandardStream` type isn't `Send` on
Windows. This can cause some surprising compile breakage, and the only
motivation for it being non-Send was dubious. Namely, it was a result of
trying to eliminate code duplication.

This refactoring also eliminates at least one "unreachable" panic case
that was a result of trying to eliminate code reuse, so that's a nice
benefit as well.

Fixes #503
2017-08-27 11:05:02 -04:00
Andrew Gallant
5213bd30ea termcolor: 80 cols 2017-08-27 11:05:02 -04:00
Andrew Gallant
2f3a8c7f69 termcolor-0.3.2 2017-03-15 06:58:09 -04:00
Andrew Gallant
3ac1b68e54 Add license info to termcolor crate.
Fixes #381
2017-03-15 06:57:54 -04:00
Andrew Gallant
c648eadbaa Bump and update deps. 2017-03-12 21:33:13 -04:00
Andrew Gallant
bf49448e1e fix badges 2017-02-19 11:28:36 -05:00
Andrew Gallant
cffba53379 use termcolor 0.3, not 0.1 2017-02-19 11:27:41 -05:00
Andrew Gallant
a5a16ebb27 termcolor-0.3.0 2017-02-18 15:07:43 -05:00
Peter Williams
22cb644eb6 termcolor: add support for output to standard error
This is essentially a rename of the existing `Stdout` type to `StandardStream`
and a change of its constructor from a single `new()` function to have two
`stdout()` and `stderr()` functions.

Under the hood, we add add internal IoStandardStream{,Lock} enums that allow
us to abstract between Stdout and Stderr conveniently. The rest of the needed
changes then fall out fairly naturally.

Fixes #324.

[breaking-change]
2017-02-09 20:57:23 -05:00
Andrew Gallant
057ed6305a 0.4.0 2017-01-13 23:46:21 -05:00
Andrew Gallant
ed60ec736c Fix invalid UTF-8 output on Windows.
Currently, Rust's standard library will yield an error if one tries to
write invalid UTF-8 to a Windows console. This is problematic for
ripgrep when it tries to print matched lines that contain invalid UTF-8.
We work around this by modifying the `termcolor` library to lossily
decode UTF-8 before sending it to `std::io::Stdout`. This may result in
some Unicode replacement chars being shown in the output, but this is
strictly better than erroring or not showing anything at all.

Fixes #318.
2017-01-13 23:21:39 -05:00
Andrew Gallant
a7d0e40668 Use basic SGR sequences when possible.
In Emacs, its terminal apparently doesn't support "extended" sets of
foreground/background colors. Unless we need to set an "intense" color,
we should instead use one of the eight basic color codes.

Also, remove the "intense" setting from the default set of colors. It
doesn't do much anyway and enables the default color settings to work
in Emacs out of the box.

Fixes #182 (again)
2017-01-13 19:03:03 -05:00
Andrew Gallant
b187c1a817 Rejigger bold and intense settings.
Previously, ripgrep would only emit the 'bold' ANSI escape sequence if
no foreground or background color was set. Instead, it would convert colors
to their "intense" versions if bold was set. The intent was to do the same
thing on Windows and Unix. However, this had a few negative side effects:

  1. Omitting the 'bold' ANSI escape when 'bold' was set is surprising.
  2. Intense colors can look quite bad and be hard to read.

To fix this, we introduce a new setting called 'intense' in the --colors
flag, and thread that down through to the public API of the `termcolor`
crate. The 'intense' setting has environment specific behavior:

  1. In ANSI mode, it will convert the selected color to its "intense"
     variant.
  2. In the Windows console, it will make the text "intense."

There is no longer any "smart" handling of the 'bold' style. The 'bold'
ANSI escape is always emitted when it is selected. In the Windows
console, the 'bold' setting now has no effect. Note that this is a
breaking change.

Fixes #266, #293
2017-01-06 20:09:51 -05:00
Andrew Gallant
084d3f4911 Small code cleanups. 2016-12-24 10:06:37 -05:00
Andrew Gallant
506f046b8b termcolor-0.1.1 2016-11-21 20:33:39 -05:00
Andrew Gallant
ae592b11e3 Only emit bold ANSI code if bold is true.
This was a simple logic error. Also, avoid emitting ANSI escape codes
if there are no color settings.

Fixes #242
2016-11-21 20:33:15 -05:00
Andrew Gallant
e8a30cb893 Completely re-work colored output and tty handling.
This commit completely guts all of the color handling code and replaces
most of it with two new crates: wincolor and termcolor. wincolor
provides a simple API to coloring using the Windows console and
termcolor provides a platform independent coloring API tuned for
multithreaded command line programs. This required a lot more
flexibility than what the `term` crate provided, so it was dropped.
We instead switch to writing ANSI escape sequences directly and ignore
the TERMINFO database.

In addition to fixing several bugs, this commit also permits end users
to customize colors to a certain extent. For example, this command will
set the match color to magenta and the line number background to yellow:

    rg --colors 'match:fg:magenta' --colors 'line:bg:yellow' foo

For tty handling, we've adopted a hack from `git` to do tty detection in
MSYS/mintty terminals. As a result, ripgrep should get both color
detection and piping correct on Windows regardless of which terminal you
use.

Finally, switch to line buffering. Performance doesn't seem to be
impacted and it's an otherwise more user friendly option.

Fixes #37, Fixes #51, Fixes #94, Fixes #117, Fixes #182, Fixes #231
2016-11-20 11:14:52 -05:00