When you delete characters on the command line using readline commands (e.g. Ctrl-U, you can paste using Ctrl-y, but where does it get stored? It does not seem to use X11 clipboard at all.
2 Answers
It goes into a kill-ring, just like in Emacs. From the GNU Readline docuementation:
When you use a kill command, the text is saved in a kill-ring. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it all. The kill ring is not line specific; the text that you killed on a previously typed line is available to be yanked back later, when you are typing another line.
Source: http://www.gnu.org/software/bash/manual/html_node/Readline-Killing-Commands.html
The kill ring is stored in memory allocated via malloc to a char pointer. From kill.c of the readline source:
/* Where to store killed text. */ static char **rl_kill_ring = (char **)NULL; - Check out my comment to vonbrand's answer.Emanuel Berg– Emanuel Berg2013-03-14 01:42:13 +00:00Commented Mar 14, 2013 at 1:42
- @EmanuelBerg I would assume it's stored in memory. The GNU readline source is the best place to find that answer.jordanm– jordanm2013-03-14 01:47:33 +00:00Commented Mar 14, 2013 at 1:47
- @EmanuelBerg I had a look at the source and update the answer.jordanm– jordanm2013-03-14 02:02:17 +00:00Commented Mar 14, 2013 at 2:02
readline is a library for tty use (at least originally), it is completely oblivious to any graphics environment (thus X clipboard or whatnot).
- Do you know where the kill ring is actually stored? Is it a stack (LIFO file) or something else? Can I examine it first hand?Emanuel Berg– Emanuel Berg2013-03-14 01:40:55 +00:00Commented Mar 14, 2013 at 1:40