#1071496 wl-clipboard: An option to strip out ANSI color and bold contol characters needed

Package:
wl-clipboard
Source:
wl-clipboard
Description:
command line interface to the wayland clipboard
Submitter:
Manny
Date:
2024-05-20 07:57:04 UTC
Severity:
normal
Tags:
#1071496#5
Date:
2024-05-20 07:53:23 UTC
From:
To:
ANSI color codes, boldfacing, and various other control codes for
linefeeds is being captured literally with wl-copy and faithfully
reproduced when pasting. This behaviour deviates from copy/paste using
a mouse. If the terminal is showing text that is colored and
formatted, and the mouse is used to select a string of text which is
then pasted into emacs or a pastebin form, the control characters are
stripped out uncolored raw text is pasted. The wl-copy tool should be
able to simulate that.

This can easily be reproduced using the “script” command to capture a
typescript, as follows:

  $ script
  $ [do anything arbitrary here, such as “man wl-clipboard”]
  $ <control-d>
  $ file typescript
  typescript: Unicode text, UTF-8 text, with CRLF, CR, LF line terminators, with escape sequences, with overstriking
  $ wl-copy -p < typescript

When pasting into a place where raw text is expected, control codes
appear. Whereas if you use a mouse to do the copy, the paste is raw
text. So it would be useful if wl-copy had an option to simulate the
mouse action.