Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

preserve color-infos in a xterm-selection

by tos (Deacon)
on Dec 18, 2009 at 08:57 UTC ( #813329=perlquestion: print w/replies, xml ) Need Help??

tos has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellows,

i know, this is not a perl question, but because i'm sure that perlmonks knowledge reaches beyond the frontiers of pure perl i'll put it here.

Does anybody know how it can be done that color-informations within a text-selection in a xterm-session can be preserved. If i select f.i. the colored output of a "ls -al --color=tty" i only get the uncolored text with a CutAndPaste-action but I would like to have the text AND the color-infos in a way you can see here:

drwxrwx---+ 9 tos Benutzer 0 Mar 25 2009 ESC[00;34m.ESC[00m drwxrwx---+ 69 tos Benutzer 0 May 8 2009 ESC[00;34m..ESC[00m -rwxr-x---+ 1 tos Benutzer 2743 Oct 26 2008 ESC[00;31mAuErrorDBESC[ +00m -rwxr-x---+ 1 tos Benutzer 1736 Jan 29 2009 ESC[00;31mXcms.txtESC[0 +0m drwxrwx---+ 2 tos Benutzer 0 Jan 6 2009 ESC[00;34mxsmESC[00m
Any suggestion or hints would be appreciated.
~*~ /@\ /%;@\ o/@,%\o /%;`@,\ hjw '^^^H^^^`

Merry Christmas and Happy New Year,


Is simplicity best or simply the easiest Martin L. Gore

Replies are listed 'Best First'.
Re: preserve color-infos in a xterm-selection
by Fox (Pilgrim) on Dec 18, 2009 at 09:31 UTC
    ls -al > data
    like this ?

      That works for the example, but it is not a generic solution to allow arbitary copies from the xterm window. It seems -- after a short Google search -- that an unmodified xterm has no way to copy color information -- at least no documented way.


      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://813329]
Approved by broomduster
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-09-28 19:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found