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

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

Merged
merged 2 commits into from
Jun 29, 2024
Merged

Conversation

matrixhead
Copy link
Contributor

@matrixhead matrixhead commented Jun 28, 2024

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

  • ls would append a clear-to-eol at the end of the colored name if it would wrap
  • $COLUMNS has more priority than the calculated terminal width

@matrixhead matrixhead force-pushed the color-clear-to-eol branch from d7ccd70 to be67bbb Compare June 28, 2024 13:20
Copy link

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)

@matrixhead matrixhead force-pushed the color-clear-to-eol branch from be67bbb to 3f1c56d Compare June 28, 2024 14:22
@matrixhead matrixhead force-pushed the color-clear-to-eol branch from 3f1c56d to 43b5164 Compare June 28, 2024 14:26
@matrixhead matrixhead marked this pull request as ready for review June 28, 2024 14:38
Copy link

GNU testsuite comparison:

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

src/uu/ls/src/colors.rs Outdated Show resolved Hide resolved
Co-authored-by: Sylvestre Ledru <[email protected]>
Copy link

GNU testsuite comparison:

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

@sylvestre sylvestre merged commit dbeae9f into uutils:main Jun 29, 2024
69 of 70 checks passed
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

Successfully merging this pull request may close these issues.

2 participants