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

Output differs (and is wrong) from cat on colored file from stark/Color-Scripts #41

Closed
ericonr opened this issue Dec 21, 2019 · 2 comments

Comments

@ericonr
Copy link

ericonr commented Dec 21, 2019

less version: 551 (PCRE regular expressions)

I was taking a look at the colored terminal scripts from stark/Color-Scripts, and one of them was, instead of a script, a text file that had to be printed to STDOUT to be visualized. It was the crowns file. When shown using

less --RAW-CONTROL-CHARS crowns

it shows a different (wrong) result than when simply printing it to the terminal (using cat).

The output from both commands (cat and less through bat) can be seen in this asciinema.

I have verified the same behavior in both Konsole and Alacritty, and have guaranteed that my terminal was wide enough for the file to be printed on it.

I first realized this problem in this issue with bat.

@gwsw
Copy link
Owner

gwsw commented Dec 22, 2019

The problem with the crowns file is it contains cursor-movement commands. There are numerous instances in the file of "ESC [ nn C" sequences to move the cursor right. This will behave differently on different terminals. It might work if you use -r but that's not recommended due to the potential for display problems if the embedded cursor movements interfere with less's management of the screen.

@ericonr
Copy link
Author

ericonr commented Dec 23, 2019

Yeah, it did work with -r. I also added -f so it didn't show the prompt asking if I wanted to read a binary file. Thanks!

That said, should I close the issue?

@ericonr ericonr closed this as completed Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants