The bug occurs when the input of vis contains a tab and it is asked to
fold at a short foldwidth, then it goes through a infinite loop.

On 2020-08-15 14:03, Martijn van Duren wrote:
Since foldit seems to be intended to determine if a row is full before a
printing it and add a new line if it would overflow it's logical that
a foldwidth of <= 8 and a tab will overflow it.

There's two ways to approach this:
1) -F has a check for < 5, which we could raise to 8 to get \t to fit.
2) Determine \t is dynamic between 1 and 8 columns, so just state that
   if we overflow don't bother and just continue to the next line.
   Downside of this approach is that the '\' will be outside the
   requested fold range.

Personally I like the second one better, so here's a quick diff to
do so. Only lightly tested.
I also like the second one.

I have just tested our patches and they both differ when the input begins
with a tab.  For example, the following:

        $ print '\ta\n' | ./vis -F8

I think that yours behaves correctly.

Reply via email to