Skip to content
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

bat (and less) output containing "^G" after clickable texts (ArchLinux-Alacritty) #3013

Closed
DanielKaleby opened this issue Jun 29, 2024 · 6 comments
Labels
question Further information is requested

Comments

@DanielKaleby
Copy link

When I try to use bat or less to display a file that contains clickable text (using the ANSI code \x1B]8), the characters "^G" are always displayed at the end of these texts, this only happens with the "links", the bold and italic texts are displayed correctly, I managed to solve this using the --raw-control-chars flag of less but this brought another problem , in which some lines of the displayed file simply disappear, and when I scroll down and then up, these lines start to appear, but in place of others (it's difficult to explain, but it's like that)
For the other ANSI formatting to work I needed to export one variable using export LESSUTFCHARDEF=E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p so I imagine the problem is that something else is missing within this variable, but what exactly?
more can display everything correctly but I really like how bat+less does things and I wanted to be able to work around this problem and use it.

To use this less flag inside the bat I launch the command like this: echo "$FILE" | bat --pager="less -raw-control-chars" --plain ($FILE=file contents)
20240629_125945

@DanielKaleby DanielKaleby added the question Further information is requested label Jun 29, 2024
@keith-hall
Copy link
Collaborator

I managed to solve this using the --raw-control-chars flag of less but this brought another problem , in which some lines of the displayed file simply disappear, and when I scroll down and then up, these lines start to appear, but in place of others (it's difficult to explain, but it's like that)

This reminds me a little of another problem with less that was reported recently. It may be worth trying less with the -c flag as well like #2973

@keith-hall
Copy link
Collaborator

also, just to check - which version of bat are you using? I guess I'm mainly curious if it includes #2544

@DanielKaleby
Copy link
Author

also, just to check - which version of bat are you using? I guess I'm mainly curious if it includes #2544

less 643 (PCRE2 regular expressions)
Copyright (C) 1984-2023  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

@DanielKaleby
Copy link
Author

DanielKaleby commented Jun 29, 2024

It's actually quite inconsistent, it only happens with some files (and only with those that have more lines than my terminal emulator can show)..
(And also the -c flag had no effect in my tests)

@eth-p
Copy link
Collaborator

eth-p commented Jun 29, 2024

Would it be possible to provide a sample file where this happens? I'm not able to reproduce the issue on my setup.

@DanielKaleby
Copy link
Author

It was an error in my files, it has nothing to do with bat/less (I thought that was it because this didn't happen in other pagers).
Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants