Finding out how many spaces a tab character is expended to

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Oct 29 18:06:58 UTC 2007


On Mon, Oct 29, 2007 at 05:27:24AM -0400, Madison Kelly wrote:
>   This isn't so much a perl question as it is a terminal question. The 
> program is perl, but I am more interested in what the user's 
> shell/terminal is doing. Ie: How can I ask the terminal, "Hey, how many 
> spaces do you expand a tab to?". Like how you can use the shell program 
> 'tput' to ask the shell how many columns a current line has.

Well 'tput it' returns 8 on my xterm, where it means 'initial tabs'
which is what the "hardware" terminal will by default use unless told
otherwise.  Not sure how to detect current settings since I think the
idea is the application should know what the tab settings are if it
changed them and otherwise they should be what the default settings is.

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list