5

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 2

7

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; 
3
  • Check out my comment to vonbrand's answer. Commented 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. Commented Mar 14, 2013 at 1:47
  • @EmanuelBerg I had a look at the source and update the answer. Commented Mar 14, 2013 at 2:02
0

readline is a library for tty use (at least originally), it is completely oblivious to any graphics environment (thus X clipboard or whatnot).

1
  • 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? Commented Mar 14, 2013 at 1:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.