GPS has an advanced mechanism for handling copy/paste operations.
When you select the menus Edit->Copy
or Edit->Cut
, GPS adds the
current selection to the clipboard. As opposed to what lots of applications
do, it doesn't discard the previous contents of the clipboard, but save it for
future usage. It saves a number of entries this way, up to 10 by default.
This value is configurable through the Clipboard Size
preference.
When you select the menu Edit->Paste
, GPS will paste the last entry
made in the clipboard at the current location in the editor.
If you immediately select Edit->Paste Previous
, this newly inserted
text will be removed, and GPS will instead insert the second to last entry
added to the clipboard. You can keep selecting the same menu to get access
to older entries.
This is a very powerful mechanism, since it means you can copy several distinct lines from a place in an editor, move to an other editor and paste all these separate lines, without having to go back and forth between the two editors.
The Clipboard View
provides a graphical mean of seeing what is currently
stored in the clipboard. It appears as a list of lines, each of which is
associated with one level of the clipboard. The text that shows in these lines
is the first line of the selection at that level that contains non blank
characters. Leading characters are discarded. [...]
is prepended
or appended in case the selection has been truncated.
If you bring the mouse over a line in the Clipboard View
, a tooltip will
pop up showing the entire selection corresponding to the line by opposition to
the possibly truncated one.
In addition, one of the lines has an arrow on its left. This indicates the
line that will be pasted when you select the menu Edit->Paste
. If you
select instead the menu Edit->Paste Previous
, then the line below that
one will be inserted instead.
If you double-click on any of these lines, GPS will insert the corresponding
text in the current editor, and make the line you clicked on the current line,
so that selecting Edit->Paste
or the equivalent shortcut will now
insert that line.
The contextual menu in the clipboard view provides one entry, which is
Append To Previous
. If you select this entry, the select line will
be append to the one below, and removed from the clipboard. This means that
selection Edit->Paste
will in fact paste the two entries at the same
time. This is in particular useful when you want to copy lines from separate
places in the initial file, merge them, and then paste them together one or
more times later on, through a single operation.
The Clipboard View content is preserved between GPS sessions. As an exception, huge entries are removed and replaced with an entry saying "[Big entry has been removed]".