How is coloured text stored in the clipboard?












1















I've been using xclip to copy text to and from terminal. I was curious how it would handle coloured text from non-terminal applications such as google docs, and libreoffice



When copying from one of these document editors to another the text colour remains, however when I use xclip -o --clipboard there doesn't seem to be any attributes or escape codes to the copied text; only the copied text is displayed.



This makes sense for most uses, you wouldn't want random escape sequences or attributes appearing within your copied text. Except when you do.



I've also tried copying some red text and then directing xclip output to a .doc file which is otherwise able to support coloured text -xclip likely does not support it.



My subsequent question is, how (if at all) can I access/view the escape sequences/colour attributes/other-representation associated with coloured text -in the clipboard?



I'm aware that terminal colour to terminal colour typically uses ANSI set graphics mode escape sequences e.g. 33[1m for bold, while doc/text editors probably use a different standard.



Think this is more an X thing than terminal thing, but in case it matters I tested & found similar behaviour on xfce4-terminal & gnome-terminal.










share|improve this question























  • Checked the source code? Everything should be right there, in xclip &/or your desktop

    – Xen2050
    Jan 29 at 9:35











  • @Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

    – Anroca
    Jan 30 at 0:33
















1















I've been using xclip to copy text to and from terminal. I was curious how it would handle coloured text from non-terminal applications such as google docs, and libreoffice



When copying from one of these document editors to another the text colour remains, however when I use xclip -o --clipboard there doesn't seem to be any attributes or escape codes to the copied text; only the copied text is displayed.



This makes sense for most uses, you wouldn't want random escape sequences or attributes appearing within your copied text. Except when you do.



I've also tried copying some red text and then directing xclip output to a .doc file which is otherwise able to support coloured text -xclip likely does not support it.



My subsequent question is, how (if at all) can I access/view the escape sequences/colour attributes/other-representation associated with coloured text -in the clipboard?



I'm aware that terminal colour to terminal colour typically uses ANSI set graphics mode escape sequences e.g. 33[1m for bold, while doc/text editors probably use a different standard.



Think this is more an X thing than terminal thing, but in case it matters I tested & found similar behaviour on xfce4-terminal & gnome-terminal.










share|improve this question























  • Checked the source code? Everything should be right there, in xclip &/or your desktop

    – Xen2050
    Jan 29 at 9:35











  • @Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

    – Anroca
    Jan 30 at 0:33














1












1








1








I've been using xclip to copy text to and from terminal. I was curious how it would handle coloured text from non-terminal applications such as google docs, and libreoffice



When copying from one of these document editors to another the text colour remains, however when I use xclip -o --clipboard there doesn't seem to be any attributes or escape codes to the copied text; only the copied text is displayed.



This makes sense for most uses, you wouldn't want random escape sequences or attributes appearing within your copied text. Except when you do.



I've also tried copying some red text and then directing xclip output to a .doc file which is otherwise able to support coloured text -xclip likely does not support it.



My subsequent question is, how (if at all) can I access/view the escape sequences/colour attributes/other-representation associated with coloured text -in the clipboard?



I'm aware that terminal colour to terminal colour typically uses ANSI set graphics mode escape sequences e.g. 33[1m for bold, while doc/text editors probably use a different standard.



Think this is more an X thing than terminal thing, but in case it matters I tested & found similar behaviour on xfce4-terminal & gnome-terminal.










share|improve this question














I've been using xclip to copy text to and from terminal. I was curious how it would handle coloured text from non-terminal applications such as google docs, and libreoffice



When copying from one of these document editors to another the text colour remains, however when I use xclip -o --clipboard there doesn't seem to be any attributes or escape codes to the copied text; only the copied text is displayed.



This makes sense for most uses, you wouldn't want random escape sequences or attributes appearing within your copied text. Except when you do.



I've also tried copying some red text and then directing xclip output to a .doc file which is otherwise able to support coloured text -xclip likely does not support it.



My subsequent question is, how (if at all) can I access/view the escape sequences/colour attributes/other-representation associated with coloured text -in the clipboard?



I'm aware that terminal colour to terminal colour typically uses ANSI set graphics mode escape sequences e.g. 33[1m for bold, while doc/text editors probably use a different standard.



Think this is more an X thing than terminal thing, but in case it matters I tested & found similar behaviour on xfce4-terminal & gnome-terminal.







linux terminal xorg colors clipboard






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 29 at 1:27









AnrocaAnroca

611




611













  • Checked the source code? Everything should be right there, in xclip &/or your desktop

    – Xen2050
    Jan 29 at 9:35











  • @Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

    – Anroca
    Jan 30 at 0:33



















  • Checked the source code? Everything should be right there, in xclip &/or your desktop

    – Xen2050
    Jan 29 at 9:35











  • @Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

    – Anroca
    Jan 30 at 0:33

















Checked the source code? Everything should be right there, in xclip &/or your desktop

– Xen2050
Jan 29 at 9:35





Checked the source code? Everything should be right there, in xclip &/or your desktop

– Xen2050
Jan 29 at 9:35













@Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

– Anroca
Jan 30 at 0:33





@Xen2050 looking at the source didn't reveal anything to suggest attributes were being stripped. I'd be willing to hack at xlib to get something working, but without knowing the standards associated with the behaviour I doubt I'd achieve much.

– Anroca
Jan 30 at 0:33










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399478%2fhow-is-coloured-text-stored-in-the-clipboard%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399478%2fhow-is-coloured-text-stored-in-the-clipboard%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕