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

nl: fix calculation of line number lengths #5091

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

cakebaker
Copy link
Contributor

This PR fixes the indentation of line numbers by adapting the calculation of the line number lengths to work with negative line numbers (introduced in #5078).

// before change
$ printf "a\nb\nc" | cargo run nl -i10 -v-19
   -19  a
   -9   b
   1    c

// after change
$ printf "a\nb\nc" | cargo run nl -i10 -v-19
   -19  a
    -9  b
     1  c

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail-2/inotify-dir-recreate

@cakebaker cakebaker force-pushed the nl_fix_output_of_line_numbers branch from 17ef237 to 27ee279 Compare July 18, 2023 07:30
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail-2/inotify-dir-recreate

@sylvestre sylvestre merged commit e15e03a into uutils:main Jul 19, 2023
44 of 45 checks passed
@cakebaker cakebaker deleted the nl_fix_output_of_line_numbers branch July 19, 2023 13:50
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