uutils / coreutils

Cross-platform Rust rewrite of the GNU coreutils
https://uutils.github.io/
MIT License
17.6k stars 1.27k forks source link

ls: gnu `color-clear-to-eol` fix #6507

Closed matrixhead closed 3 months ago

matrixhead commented 3 months ago

This pr tries to fix gnu test case color-clear-to-eol. This test tries to check when a colored file name that is too long is wrapped, it will append a clear-to-end-of-line ANSI code. GNU's ls does this because in some terminals, when ls tries to print at the last line of the terminal window and needs to scroll the text up in order to print the new lines, the background color would stretch up to the end of the line. for example

seq 200 # inorder to fill the terminal window
touch zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo # create a long named file so that it would wrap
env TERM=xterm  LS_COLORS="*.foo=0;31;42" TIME_STYLE=+T ls  --color=always zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo

without the patch, it would look like this without k with the patch with k

Behaviors changed

github-actions[bot] commented 3 months ago

GNU testsuite comparison:

Congrats! The gnu test tests/ls/color-clear-to-eol is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
github-actions[bot] commented 3 months ago

GNU testsuite comparison:

Congrats! The gnu test tests/ls/color-clear-to-eol is no longer failing!
github-actions[bot] commented 3 months ago

GNU testsuite comparison:

Congrats! The gnu test tests/ls/color-clear-to-eol is no longer failing!