From: Intransition Date: 2012-04-28T12:37:31+09:00 Subject: Re: Global variable for spaces per tab? ------=_Part_539_13511113.1335584249148 Content-Type: multipart/alternative; boundary="----=_Part_540_18442831.1335584249148" ------=_Part_540_18442831.1335584249148 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Friday, April 27, 2012 5:01:37 PM UTC-4, Eric Christopherson wrote: > > On Apr 27, 2012 3:29 PM, "Aaron Patterson" > wrote: > > > > On Sat, Apr 28, 2012 at 05:22:47AM +0900, Ryan Davis wrote: > > > > > > On Apr 27, 2012, at 11:51 , Intransition wrote: > > > > > > > Is there any global variable in Ruby for specifying how tabs ("\t") > should be translated into spaces? > > Intransition: the amount of space shown by a tab is totally dependent on > the terminal used to display the text, and (unlike some terminal > parameters) there is no way for Ruby or any language to change it. I guess > the best thing you could do would be to implement a writer stream that > converted tabs to spaces. > I guess I worded that poorly. I was just wondering if there is some setting to be read --not change. I'm not even sure ... is there such a setting in shell/bash? My use case is string unindention. Say I have a string with each line is prefixed with two "\t" characters and I want to unindent it by upto 2 spaces. Then I need to translate the tabs to spaces. The unindent method can have an option for it, but I was wondering if there is some system setting I can look at for deciding a default. ------=_Part_540_18442831.1335584249148 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

On Friday, April 27, 2012 5:01:37 PM UTC-4, Eric Christopherson wrote:

On Apr 27, 2012 3:29 PM, "Aaron Patterson" <tenderlove@ruby-lang.org> wrote:
>
> On Sat, Apr 28, 2012 at 05:22:47AM +0900, Ryan Davis wrote:
> >
> > On Apr 27, 2012, at 11:51 , Intransition wrote:
> >
> > > Is there any global variable in Ruby for specifying how tabs ("\t") should be translated into spaces?

Intransition: the amount of space shown by a tab is totally dependent on the terminal used to display the text, and (unlike some terminal parameters) there is no way for Ruby or any language to change it. I guess the best thing you could do would be to implement a writer stream that converted tabs to spaces.


I guess I worded that poorly. I was just wondering if there is some setting to be read --not change. I'm not even sure ... is there such a setting in shell/bash?

My use case is string unindention. Say I have a string with each line is prefixed with two "\t" characters and I want to unindent it by upto 2 spaces. Then I need to translate the tabs to spaces. The unindent method can have an option for it, but I was wondering if there is some system setting I can look at for deciding a default.


------=_Part_540_18442831.1335584249148-- ------=_Part_539_13511113.1335584249148--