Thomas Leonhardt wrote:
>
> My question is, why is the class FixCRLF limited this way?
> I think everybody should be able to decide for him-/herself
> which tab length to use. Or are the limitations resulting
> from the way the class is implemented?
>
> I just kicked the line which does the check and then
> compiled. For the java files I used the changed version on
> everything seems to work fine.

You got lucky.  Code such as the following presumes powers of two.

   // advance column to next tab stop
   col = (col|(tablength-1))+1;

If you specified "3", tabs would have the following result:

   Col 1 => 4
   Col 2 => 3
   Col 3 => 4
   Col 4 => 7
   Col 5 => 8
   Col 6 => 7

What is needed instead is something like:

   col = ((int)(col/tablength)+1)*tablength;

Which is a bit less efficient.  At the time I wrote the original code that
this is based on (over a decade ago), I was very concerned about such
things.

- Sam Ruby

Reply via email to