Bat: linenumbers and outline not 'in line' after more than 10000 lines

Created on 9 Jul 2019  Â·  4Comments  Â·  Source: sharkdp/bat

Hello people, not sure if this is worth fixing but I noticed that for files with more than 10000 lines the separator between line numbers and the file content is not aligned as expected. When I do bat <file with more than 10000 lines> and 10000G this is what I see:

9997   │ -462 -469 0
9998   │ -463 -464 0
9999   │ -463 -465 0
10000   │ -463 -466 0
10001   │ -463 -467 0

My bat --version output is bat 0.10.0

question

All 4 comments

The misalignment was an intentional trade off that I made when I refactored the sidebar decorations in b327127. With the current implementation, bat doesn't have any way to retrieve the total number of lines in a file/stream before actually processing it, and decorations must have a predetermined width to use for alignment.

A width of 4 (lines 1 through 9999) was chosen at the time, since it wouldn't take up too much space in the sidebar and it didn't seem likely that people would be trying to read files larger than 10000 lines.

I think it's a good trade off personally

With the current implementation, bat doesn't have any way to retrieve the total number of lines in a file/stream before actually processing it

Exactly. And this is very likely to stay that way, because we want bat to be able to operate on streams. Unfortunately, that means that we will have the misalignment-effect at some point. I also think that it's a reasonable trade off.

thanks for getting back to me, I thought this was the case but just wanted to let you know :)

Was this page helpful?
0 / 5 - 0 ratings