Mailing List Archive

An annoyance in GPM, and a fix for it
Hello, Gentoo.

In the GPM mouse utility in a tty, one can use a double click to select
a word (and by holding the button down and moving the mouse, select a
sequence of words).

Similarly, with a triple click, one can select a line, or a sequence of
lines. This is all very fine, but GPM adds a CR after each line in the
sequnce, INCLUDING THE LAST ONE. This makes it less useful for, say,
copying a shell script command from and editor onto a command line.
Because typically, you'd want to edit the command before executing it,
but with GPM's mechanism, the CR on the end immediately executes it, not
giving you a chance to edit it.

A solution to this problem is not to append the CR to the last line in a
sequence of lines selected by GPM. This means patching the kernel. To
apply the patch, first get the attached patch into the kernel's
directory, and do something like:

# patch -p1 < 6.1.8-TRIPLE.20231004.diff

, then rebuild the kernel. Install this kernel into your boot manager,
and voil? - the problem is solved. :-)

The usual disclaimer applies.

--
Alan Mackenzie (Nuremberg, Germany).
Re: An annoyance in GPM, and a fix for it [ In reply to ]
On 04/10/2023 21:11, Alan Mackenzie wrote:
> Similarly, with a triple click, one can select a line, or a sequence of
> lines. This is all very fine, but GPM adds a CR after each line in the
> sequnce, INCLUDING THE LAST ONE. This makes it less useful for, say,
> copying a shell script command from and editor onto a command line.
> Because typically, you'd want to edit the command before executing it,

Hm. Bash by default will ignore a newline when pasting something. I
think it's relatively new feature (like a year or two.) It's called
"bracketed paste." It should be enabled by default. If not, it can
enabled with:

set enable-bracketed-paste on