bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash doesn't display tabs for tabs -- ignores tabstops.


From: Linda Walsh
Subject: Re: bash doesn't display tabs for tabs -- ignores tabstops.
Date: Mon, 22 Apr 2013 10:54:35 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666


Greg Wooledge wrote:
> On Sun, Apr 21, 2013 at 12:25:20AM -0700, Linda Walsh wrote:
>> If I 'reedit my last "statement", it indents 8 spaces/tab.
> 
> What does this sentence mean?  I am completely stumped.  What is
> the sequence of steps you are actually performing?
---
Type in this:
echo 'while read fn;do
<tab>d=${fn%.zip}
<tab>(
<tab><tab>cd "$d" && {
<tab><tab><tab>base=${d%-*}
<tab><tab><tab>if [[ -e $base.exe ]] ;then
<tab><tab><tab><tab>mv "$base.exe" "$d.exe" && ln -s "$d.exe"
"$base.exe"
<tab><tab><tab>fi
<tab><tab><tab>cp * ../bin
<tab><tab>}
<tab>)
done'
-----
Note, hit the tab key for <tab>, don't type in 5-char-string meaning tab!.

Now, for me, the above looks like:

while read fn;do
  d=${fn%.zip}
  (
    cd "$d" && {
      base=${d%-*}
      if [[ -e $base.exe ]] ;then
        mv "$base.exe" "$d.exe" && ln -s "$d.exe"
"$base.exe"
      fi
      cp * ../bin
    }
  )
done

when I have my terminal's HW tabstop set to every 2 columns.

But when I ***re-edit** the line... (I'm in vi-mode, so it's "<ESC>k">)
Bash will redisplay the echo line -- But instead of the displayed line
being displayed as output from echo (or cat), BASH when it redisplays the line,
doesn't use the actual TAB character when displaying the line.  Instead
it expands the TAB chars to spaces, and as a result, gets it wrong.

By not using the actual tab character when it echo's out the re-edit line, it 
has
2 effects -- 1: it doesn't display properly if someone has their tab stop set
to other than 8-spaces/tab, and 2) if you cut/paste the text -- the text no
longer contains embedded tabs but contains spaces.

I.e. when I cut/copy text from my terminal screen that was written with tabs,
the tabs are in the buffer -- not spaces.  so when I paste it, the text is
the same as the source. Applications that convert it to text disable a clean
roundtrip copy/paste ability.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]