summaryrefslogtreecommitdiffstats
path: root/termcolor
AgeCommit message (Collapse)Author
2018-07-17termcolor: moved to its own repositoryAndrew Gallant
We also move wincolor with it. Fixes #924
2018-06-23termcolor: add BufferedStandardStreamAndrew Gallant
This commit adds a new type, BufferedStandardStream, which emulates the StandardStream API (sans `lock`), but will internally use a buffered writer. To achieve this, we add a new default method to the WriteColor trait that indicates whether the underlying writer must synchronously communicate with an API to control coloring (e.g., the Windows console API). The new BufferedStandardStream then uses this default method to determine how eager it should be to flush its buffer before employing color settings. This should have basically zero overhead when using ANSI color escape sequences.
2018-03-26termcolor: release 0.3.6termcolor-0.3.6Andrew Gallant
2018-03-26termcolor: fix bold + intense colors in Win 10ehuss
There is an issue with the Windows 10 console where if you issue the bold escape sequence after one of the extended foreground colors, it overrides the color. This happens in termcolor if you have bold, intense, and color set. The workaround is to issue the bold sequence before the color. Fixes rust-lang/rust#49322
2018-03-03termcolor/doc: fix typoRichard Dodd (dodj)
2018-02-20termcolor: release 0.3.5termcolor-0.3.5Andrew Gallant
2018-02-20termcolor: add ?Sized bound for &mut T implMarkus Westerlind
2018-02-20termcolor: improve "intense" docsBalaji Sivaraman
Fixes #797
2018-02-20termcolor: add underline supportBalaji Sivaraman
This commit adds underline support to the termcolor crate, and exposes it through ripgrep. Fixes #798
2018-02-11termcolor: release 0.3.4termcolor-0.3.4Andrew Gallant
2018-02-10termcolor: support ANSI in Windows terminalsAndrew Gallant
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-10termcolor: permit hex colorsAndrew Gallant
This commit adds support for specifying Ansi256 or RGB colors using hexadecimal notation.
2018-01-29termcolor: add extended color supportMarc Tiehuis
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-29termcolor: tweak reset escapekennytm
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-01cleanup: replace try! with ?Balaji Sivaraman
2017-10-21Fix typosShubham Lagwankar
2017-08-27termcolor-0.3.3termcolor-0.3.3Andrew Gallant
2017-08-27termcolor: make StandardStream be SendAndrew Gallant
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-27termcolor: 80 colsAndrew Gallant
2017-03-15termcolor-0.3.2termcolor-0.3.2Andrew Gallant
2017-03-15Add license info to termcolor crate.Andrew Gallant
Fixes #381
2017-03-12Bump and update deps.wincolor-0.1.3termcolor-0.3.1ignore-0.1.8grep-0.1.6globset-0.1.4Andrew Gallant
2017-02-19fix badgesAndrew Gallant
2017-02-19use termcolor 0.3, not 0.1Andrew Gallant
2017-02-18termcolor-0.3.0termcolor-0.3.0Andrew Gallant
2017-02-09termcolor: add support for output to standard errorPeter Williams
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-01-130.4.00.4.0Andrew Gallant
2017-01-13Fix invalid UTF-8 output on Windows.Andrew Gallant
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-13Use basic SGR sequences when possible.Andrew Gallant
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-06Rejigger bold and intense settings.Andrew Gallant
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
2016-12-24Small code cleanups.Andrew Gallant
2016-11-21termcolor-0.1.1termcolor-0.1.1Andrew Gallant
2016-11-21Only emit bold ANSI code if bold is true.Andrew Gallant
This was a simple logic error. Also, avoid emitting ANSI escape codes if there are no color settings. Fixes #242
2016-11-20Completely re-work colored output and tty handling.Andrew Gallant
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