Skip to content

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
@github-actions
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
@github-actions
Copy link

GNU testsuite comparison:

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

Co-authored-by: Sylvestre Ledru <[email protected]>
@github-actions
Copy link

GNU testsuite comparison:

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

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