[TxMt] column counter bug in conjunction with TABs?

Hans-Joerg Bibiko bibiko at eva.mpg.de
Mon Nov 6 12:56:43 UTC 2006


On 6 Nov 2006, at 13:38, Allan Odgaard wrote:

> On 6. Nov 2006, at 13:18, Hans-Joerg Bibiko wrote:
>
>> TAB TAB TAB HalloTAB World
>> |   |   |   |        |
>> |   |   |   |        -21!!! (it should be 22!!)
>
> No, it should be 21:
>
>     % echo -n 'A'|expand -t4|wc -c
>        1
>
>     % echo -n '\t\t\tHello\tW'|expand -t4|wc -c
>       21

Please forgive me, but my opinion this is wrong!!!

Example: (a TAB is XXXX := Tab Size=4)

\t\t\tHello\tW written as an array beginning at index 1:

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22
X  X  X  X  X  X  X  X  X  X  X  X  H  e  l  l  o  X  X  X  X  W
|        |  |        |  |        |  |           |  |        |  |
---TAB----  ---TAB----  ---TAB----  --Hello------  ---TAB----  W

If % echo -en '\t\t\tHello\tW'|expand -t4|wc -c is right then the 4th  
TAB is count only as 3 spaces plus \t !

Cheers,

Hans



More information about the textmate mailing list