On Thu, Jun 13, 2024 at 12:16:00PM +1000, Charlie wrote:
> Cannot recall what version of Debian stopped copying text in xterm by
> Ctrl + C or Shift + Ctrl + C  So don't know how to copy from xterm

xterm is a terminal emulator.  Pressing Ctrl-C in a terminal emulator
simply passes a byte (0x03) to the application running inside the
terminal, which is usually a shell.  But they're interpreted by the
terminal driver layer first.  The stty command allows you to see or
change the bindings of control characters by the terminal driver.

Ctrl-C is usually bound to the 'intr' facility in the terminal driver.
Pressing it in a terminal sends the interrupt signal (SIGINT) to all
running foreground processes.  It does not copy text.  That's a Windows
thing, and you are not in Windows.

> Unable to paste  from xterm into a text editor using Ctrl + V or Shift
> + Ctrl + V

Pressing Ctrl-V in a terminal emulator sends a byte (0x16) to the
application.  At the terminal driver layer, Ctrl-V is usually bound
to the 'lnext' facility (literal next).  It's like an escape sequence
for keys.  The next key you press *after* Ctrl-V will lose its special
meaning, and will just be passed along verbatim.

For example, if you press Ctrl-V Ctrl-C, it won't interrupt foreground
processes.  Instead, it will simply pass the literal 0x03 byte to the
application.  It becomes data.

hobbit:~$ printf ^C | hd
00000000  03                                                |.|
00000001

The ^C there is where I pressed Ctrl-V Ctrl-C.

Now, all of that is just background information.

What you wanted to know, I guess, is "how to copy text between terminals".

The first step is to highlight the text with the left mouse button.  Drag
the mouse over the text while holding the left button.  This creates
a "selection" containing the text you've selected.

Next, click on the window that you want to paste the text *into*.  You
need this window to have "focus".  Depending on your window manager,
clicking may not actually be needed.  Some WMs use "focus follows mouse",
which means the mouse pointer simply has to be inside the window.  Others
use "click to focus" which means you have to click.

Once you've focused on the receiving window, press the middle mouse
button to paste the selection into the second window.

(X11 uses three-button mice.  Everything is designed around this.)

If your mouse is too new or too Microsoft-tainted to have three buttons,
then things get tricky.

If your mouse is literally an old PS/2 style two-button mouse from the
1980s, you might be in real trouble.  There are hacks to try to mimic
the middle button in other ways, but you'll have to read documentation
to learn how to invoke them.

Let's assume that's not the case.

If your mouse has two buttons plus a scroll wheel, you might be able to
press the scroll wheel to act as the middle button.  Doing this without
also *turning* the scroll wheel takes practice.  It can be done, at
least sometimes.

So, that's how you copy and paste text between windows in X11.  You
select with the left button, and paste with the middle button.

Obviously the world can't be that simple.  While X11 was developing
this interface around three-button mice, Microsoft was building a
different interface around two-button mice.

In the Microsoft paradigm, you copy by highlighting the text you want
to copy, and then performing a second step.  That step might be
right-clicking a menu and selecting "Copy".  Or it might be pressing
Ctrl-C (but not in a terminal emulator).  Once you've performed this
copy operation, the text is in a "clipboard", which is separate from
the "selection".

Pasting text from the clipboard into a new window under the Microsoft
paradigm is done by pressing Shift-Insert.  (Or by right-clicking a
menu and selecting Paste, or by pressing Ctrl-V in some programs, but
not in terminal emulators.)

Some programs that you run on Debian may use the Windows paradigm and
put data into the clipboard instead of the selection.  For those
things, you can try Shift-Insert instead of the middle button.  It's
just another thing you might need to know/use.

Good luck.

Reply via email to