* [gentoo-user] An annoyance in GPM, and a fix for it
@ 2023-10-04 18:11 Alan Mackenzie
2023-10-09 9:36 ` [gentoo-user] " Nikos Chantziaras
0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2023-10-04 18:11 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
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).
[-- Attachment #2: 6.1.8-TRIPLE.20231004.diff --]
[-- Type: text/plain, Size: 476 bytes --]
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 6ef22f01cc51..e2a07b8759ed 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -217,7 +217,8 @@ static int vc_selection_store_chars(struct vc_data *vc, bool unicode)
unless non-space at end of line. */
if (obp != bp) {
bp = obp;
- *bp++ = '\r';
+ if ((i + 2) < vc_sel.end) /* Don't add \r to the last line. */
+ *bp++ = '\r';
}
obp = bp;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-user] Re: An annoyance in GPM, and a fix for it
2023-10-04 18:11 [gentoo-user] An annoyance in GPM, and a fix for it Alan Mackenzie
@ 2023-10-09 9:36 ` Nikos Chantziaras
0 siblings, 0 replies; 2+ messages in thread
From: Nikos Chantziaras @ 2023-10-09 9:36 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-09 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 18:11 [gentoo-user] An annoyance in GPM, and a fix for it Alan Mackenzie
2023-10-09 9:36 ` [gentoo-user] " Nikos Chantziaras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox