delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/07/08:25:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_05,SPF_PASS
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
CC: "'Ralf Gans'" <Ralf DOT Gans AT NSG-GmbH DOT de>
Date: Sat, 7 Feb 2009 08:16:35 -0500
Subject: RE: Copy converts tabs to spaces ?
Message-ID: <0105D5C1E0353146B1B222348B0411A2182F4DED@NIHMLBX02.nih.gov>
References: <WorldClient-F200902021105 DOT AA05540020 AT butn DOT net> <A45AE599-B6AC-41DA-A230-CD3C1C7A4F67 AT NSG-GmbH DOT de> <0105D5C1E0353146B1B222348B0411A2182F4DC2 AT NIHMLBX02 DOT nih DOT gov> <B7021E1A-156E-4F9B-ADFC-B6DE58D5E14D AT NSG-GmbH DOT de>
In-Reply-To: <B7021E1A-156E-4F9B-ADFC-B6DE58D5E14D@NSG-GmbH.de>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

> On 02.02.2009, at 21:16, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>> Ralf Gans wrote on Monday, February 02, 2009 8:57 AM:
>>> On 02.02.2009, at 11:05, xerces8 wrote:
>>>> I noticed that when copying text from a the Cygwin Bash window and
>>>> then pasting it somewhere (like WordPad), tabulator characters are
>>>> converted to spaces.=20
>>>>=20
>>>> The same happens with RXVT too.
>>>>=20
>>>> Details:
>>>> - print the content of some text file that has tabs (like a C
>>>> program source) : cat foo.c=20
>>>> - select and copy the text with the mouse
>>>> - paste (ctrl-V) into WordPad
>>>>=20
>>>> The text in Wordpad has no more tabs.
>>>>=20
>>>> Is there a way around this ?
>>>=20
>>> copy an paste from window to window takes what's printed, not what
>>> you have written.=20
>>>=20
>>> So, if the terminal prints spaces to represent the tabs, as a
>>> terminal usually does, you CAN only copy spaces.
>>=20
>> Think about using putclip instead.
>>=20
>>  $ cat foo.c | putclip -d
>>  $ putclip -d < foo.c
>>=20
>> You also might want to familiarize yourself with getclip.

A related trick:

  $ getclip -u | pipe | putclip -d

One might not think of it since the following doesn't work.

  $ cat foo | pipe > foo

In the latter example, the shell opens (and truncates) foo for writing
before cat reads foo.  But it seems that putclip does nothing to the
clipboard until the pipe closes, so getclip is finished before the
clipboard is overwritten.

Also `getclip -u` =3D=3D $(getclip -u) can sometimes be a convenient way
to provide arguments to a command.

I find getclip and putclip to be real work-savers.  If I have to
do something to multiple chunks of info that has to go through
the Windows clipboard, they let me repeat a pipe by just hitting
the <up-arrow> and <enter>.

Sorry I omitted this from my earlier post.

Enjoy!

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019