folkertvanheusden / multitail

Tail on steroids
https://vanheusden.com/multitail/
MIT License
129 stars 13 forks source link

Line wrapping with tab characters #18

Open maneandrea opened 1 year ago

maneandrea commented 1 year ago

When there is a \t character, multitail considers it as if it occupies a single space and so the line wrapping is wrong. Suppose we have a file with a tab, the text "some text" and then a very long sequence of "."

Expected

< tab character >some text..........|| other column
rest of file                        || other line of other column

Actual

< tab character >some text..........|| other column
................                    || other line of other column
rest of file                        || etc ...

Notice that in the actual case, the sequence of "." stops exactly one space before the end of the <tab character>, meaning that when multitail computes the required length it considers <tab character> to be long 1 instead of its actual length (16 in this example but 8 in real life).

Here is the culpirit mt.c#L392. strlen counts \t as 1. I wouldn't know the best way to fix this though.