-
Notifications
You must be signed in to change notification settings - Fork 89
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
grep --color=always ... | less -R
garbled since 580
#140
Comments
cc: @keszybz @tomprince @poettering Arch upgraded less to support systemd's hyperlinks (#54). Is Fedora now also suffering from this bug? |
- Add a missing `ansi_done` to `bin_file` to free `pansi`. - Fix the inverted loop condition in `skip_ansi` so it actually skips. - Fix a condition in `step_ansi`: `pansi->hindex == 0` was never true. - Fix the sequence removal in `store_ansi` to reset the `line_ansi`. Fixes gwsw#140
This is mostly fixed in 7928864. Thanks to @heftig for the fix.
I will investigate whether there is some easy workaround to ignore these line erase sequences, but it's rather annoying that grep is putting this junk into its output. |
@gwsw I see you didn't take the hunk changing the hindex increment in if (ch == hlink_prefix[pansi->hindex++] ||
(pansi->hindex == 0 && IS_CSI_START(ch))) |
Hi, just wanted to confirm that I can no longer see the bug in v581. Thank you! |
How to reproduce:
I would expect it to print that one matching line (colored):
It’s because
grep
uses lots of “Erase in Line” escape sequences:https://git.savannah.gnu.org/cgit/grep.git/tree/src/grep.c?id=54aac0789909618122d7125854c443f26a94f610#n317
I am not sure how “Erase in Line” is supposed to be interpreted. My VTE terminal and XTerm only erase characters that were already on screen:
Piping the second command through
less
erases thea
as well and I guess that’s not correct?(I also see some more corruption like blinking output or misplaced cursors, but I have no idea why that happens, so I can’t provide a meaningful but report for that.)
Let me know if there’s anything else I can do to help.
Thanks!
– edit: Forgot to mention it, this is on Arch Linux with less 580, grep 3.6, XTerm 366, and vte3 0.64.0.
The text was updated successfully, but these errors were encountered: