-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
^O characters in coloured output #37
Comments
Yup, I can reproduce it. Setting |
N.B. When I'm in a screen session, if I do |
Same here (ArchLinux, tmux 2.2, rg 0.2.1). In tmux my $TERM is |
Yes, I can work around it. ^O is shift-in, i.e. switch to non-graphic character set, so may be part of a generic "reset" sequence. As I need to add |
@uazu Ah thanks for the explanation. I think other tools seem to work fine, so we should try to fix it. Documenting it as a known bug in the README is also a good idea. By the way, you may also be interested in the |
According to Looking at the terminfo database entry for
...so whenever ripgrep calls If there's a bug here, I'd say it's in |
Well, I now have a wrapper around ripgrep which sets TERM=xterm and pipes to |
|
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
Thanks. I confirm the fix. |
Viewing with
--color always
piped toless -R
, colours appear correctly but there are ^O characters (\x0F) inserted regularly, which appear in less as inverted^O
. When removed withsed 's/\x0f//g'
output appears like screenshot.Tested release binary version 0.1.16 on Debian Linux, with TERM=screen.linux.
The text was updated successfully, but these errors were encountered: