GNU bug report logs -
#25540
notice issue in expand -- doesn't allow for expressing tabsize value in tabstop(s)
Previous Next
Reported by: L A Walsh <coreutils <at> tlinx.org>
Date: Thu, 26 Jan 2017 04:30:02 UTC
Severity: normal
Tags: fixed
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 25540 <at> debbugs.gnu.org (full text, mbox):
On 26/01/17 10:26, Reuti wrote:
>
>> Am 26.01.2017 um 05:29 schrieb L A Walsh <coreutils <at> tlinx.org>:
>>
>>
>> In programs that take tabstops, as an alternative to a tabsize, I've always
>> seen tabs beyond the end of the list taken as equal to the highest tab-stop
>> difference. So for a tabsize=8, a tabset of 1,9 would be equivalent -- with
>> tabs above "9" being "9-1" or every 8th column above 9.
>>
>> Otherwise you have no way of expression all tabs on a line that stretches out to
>> "???" 160? 240? what? other than to enumerate tabstops to infinity.
>>
>> If they want to limit tabstops above the last to size "1", they can use something like 1,9,10. How else can one specify tabs beyond the last
>> for a size other than "1"?
>>
>> Could this be changed/fixed?
>
> For now the behavior is like specified on the info page: "[…] and replace any tabs beyond the last tab stop given with single spaces." To avoid that this gets broken, I would suggest to use a modified syntax like 1,9,30,34,/4 for using a width of 4 beyond 34.
>
I like that. Explicit and extensible.
An alternative could be: --tabs=1,9,30,34,+4 ?
> This could even be expanded to: -t 2/4,120,4/5,/9
>
> Two times a width of 4, a fixed 120, four times a width of 5 and all remaining have a width of 9 (could also be */9 instead of /9).
That might be overkill.
It wouldn't provide extra functionality, only a shortcut,
and a very rarely used one at that.
> While we are on this:
>
> expand -t 5,15,25,35 file
> expand -t 5,15,25,,,,35 file
>
> are AFAICS both the same. I would expect the second to behave different (using a space for the three tabs which have no value).
I'm not sure we should assume empty = 1.
Note FreeBSD rejects this format:
$ seq 8 | paste -s -d$'\t' - | expand -t1,,2
expand: bad tab stop spec
One might consider and empty value after a comma to mean take the previous tab stop width,
and that would be a partially backwards compat way to provide the original request, i.e.:
expand -t 1,9,,
However that seems a bit hacky and non obvious.
thanks,
Pádraig
This bug report was last modified 6 years and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.