* [PATCH man v2 0/2] TIOCLINUX.2const: Document TIOCL_SETSEL selection modes
@ 2025-02-23 21:36 Günther Noack
2025-02-23 21:36 ` [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for " Günther Noack
2025-02-23 21:36 ` [PATCH man v2 2/2] TIOCLINUX.2const: Document missing " Günther Noack
0 siblings, 2 replies; 9+ messages in thread
From: Günther Noack @ 2025-02-23 21:36 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: Jared Finder, Günther Noack, linux-man
Hi!
TIOCLINUX's TIOCL_SETSEL sub-code has another layer of sub-operations,
called "selection modes" (even though not all of them actually deal
with the mouse selection).
Going forward, the CAP_SYS_ADMIN requirement will be different for
some of these selection modes, which prompted me to at least list the
different selection modes with a short description. I am leaving
CAP_SYS_ADMIN documentation as it is for now and will send another
patch once these semantics are finalized [1] [2].
Thanks,
–Günther
[1] <https://lore.kernel.org/all/20250221.0a947528d8f3@gnoack.org/>
[2] <https://lore.kernel.org/all/20250223205449.7432-2-gnoack3000@gmail.com/>
History:
V2:
* Split into a "restructuring" and a "new documentation" commit
* Use non-breaking space \~
* Put URIs in <>
* Added a helpful link to console_codes(4) regarding mouse reporting
Günther Noack (2):
TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection
modes
TIOCLINUX.2const: Document missing TIOCL_SETSEL selection modes
man/man2const/TIOCLINUX.2const | 52 ++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 5 deletions(-)
base-commit: fe7e094e78139a4ac5ee31b2321b77041c725794
--
2.48.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection modes 2025-02-23 21:36 [PATCH man v2 0/2] TIOCLINUX.2const: Document TIOCL_SETSEL selection modes Günther Noack @ 2025-02-23 21:36 ` Günther Noack 2025-02-23 23:13 ` Jared Finder 2025-02-23 21:36 ` [PATCH man v2 2/2] TIOCLINUX.2const: Document missing " Günther Noack 1 sibling, 1 reply; 9+ messages in thread From: Günther Noack @ 2025-02-23 21:36 UTC (permalink / raw) To: Alejandro Colomar; +Cc: Jared Finder, Günther Noack, linux-man * Indent the documented selection modes into tagged paragraphs. * Document constants from the header file (tiocl.h) instead of numbers. Signed-off-by: Günther Noack <gnoack3000@gmail.com> --- man/man2const/TIOCLINUX.2const | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/man/man2const/TIOCLINUX.2const b/man/man2const/TIOCLINUX.2const index c0acdd0ea..5db3f6ea6 100644 --- a/man/man2const/TIOCLINUX.2const +++ b/man/man2const/TIOCLINUX.2const @@ -65,11 +65,24 @@ are the ending column and row. (Upper left corner is row=column=1.) .I sel_mode -is 0 for character-by-character selection, -1 for word-by-word selection, -or 2 for line-by-line selection. -The indicated screen characters are highlighted and saved -in a kernel buffer. +may be one of the following operations: +.RS +.TP +.B TIOCL_SELCHAR +Select character-by-character. +The indicated screen characters are highlighted +and saved in a kernel buffer. +.TP +.B TIOCL_SELWORD +Select word-by-word. +The indicated screen characters are highlighted +and saved in a kernel buffer. +.TP +.B TIOCL_SELLINE +Select line-by-line. +The indicated screen characters are highlighted +and saved in a kernel buffer. +.RE .IP Since Linux 6.7, using this subcode requires the .B CAP_SYS_ADMIN -- 2.48.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection modes 2025-02-23 21:36 ` [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for " Günther Noack @ 2025-02-23 23:13 ` Jared Finder 2025-03-02 7:06 ` Alejandro Colomar 2025-03-02 19:00 ` Günther Noack 0 siblings, 2 replies; 9+ messages in thread From: Jared Finder @ 2025-02-23 23:13 UTC (permalink / raw) To: Günther Noack; +Cc: Alejandro Colomar, linux-man I'm not a regular kernel developer, so feel free to ignore my recommendations if they are not aligned with the level of documentation usually provided. On 2025-02-23 13:36, Günther Noack wrote: > * Indent the documented selection modes into tagged paragraphs. > * Document constants from the header file (tiocl.h) instead of numbers. > > Signed-off-by: Günther Noack <gnoack3000@gmail.com> > --- > man/man2const/TIOCLINUX.2const | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/man/man2const/TIOCLINUX.2const > b/man/man2const/TIOCLINUX.2const > index c0acdd0ea..5db3f6ea6 100644 > --- a/man/man2const/TIOCLINUX.2const > +++ b/man/man2const/TIOCLINUX.2const > @@ -65,11 +65,24 @@ are the ending > column and row. > (Upper left corner is row=column=1.) > .I sel_mode > -is 0 for character-by-character selection, > -1 for word-by-word selection, > -or 2 for line-by-line selection. > -The indicated screen characters are highlighted and saved > -in a kernel buffer. > +may be one of the following operations: > +.RS > +.TP > +.B TIOCL_SELCHAR > +Select character-by-character. > +The indicated screen characters are highlighted > +and saved in a kernel buffer. I would recommend also saying > +.TP > +.B TIOCL_SELWORD > +Select word-by-word. > +The indicated screen characters are highlighted > +and saved in a kernel buffer. I would recommend also saying something like "The start is expanded backward and the end is expanded forwards to select entire words." > +.TP > +.B TIOCL_SELLINE > +Select line-by-line. > +The indicated screen characters are highlighted > +and saved in a kernel buffer. > +.RE Similarly, mention how the start / end is expanded here too. > .IP > Since Linux 6.7, using this subcode requires the > .B CAP_SYS_ADMIN -- MJF ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection modes 2025-02-23 23:13 ` Jared Finder @ 2025-03-02 7:06 ` Alejandro Colomar 2025-03-02 19:45 ` Günther Noack 2025-03-02 19:00 ` Günther Noack 1 sibling, 1 reply; 9+ messages in thread From: Alejandro Colomar @ 2025-03-02 7:06 UTC (permalink / raw) To: Jared Finder; +Cc: Günther Noack, linux-man [-- Attachment #1: Type: text/plain, Size: 2243 bytes --] Hi Günther, Jared, On Sun, Feb 23, 2025 at 03:13:35PM -0800, Jared Finder wrote: > I'm not a regular kernel developer, so feel free to ignore my > recommendations if they are not aligned with the level of documentation > usually provided. > > On 2025-02-23 13:36, Günther Noack wrote: > > * Indent the documented selection modes into tagged paragraphs. > > * Document constants from the header file (tiocl.h) instead of numbers. > > > > Signed-off-by: Günther Noack <gnoack3000@gmail.com> I have no comments of my own. What do you want to do about the ones from Jared? Have a lovely day! Alex > > --- > > man/man2const/TIOCLINUX.2const | 23 ++++++++++++++++++----- > > 1 file changed, 18 insertions(+), 5 deletions(-) > > > > diff --git a/man/man2const/TIOCLINUX.2const > > b/man/man2const/TIOCLINUX.2const > > index c0acdd0ea..5db3f6ea6 100644 > > --- a/man/man2const/TIOCLINUX.2const > > +++ b/man/man2const/TIOCLINUX.2const > > @@ -65,11 +65,24 @@ are the ending > > column and row. > > (Upper left corner is row=column=1.) > > .I sel_mode > > -is 0 for character-by-character selection, > > -1 for word-by-word selection, > > -or 2 for line-by-line selection. > > -The indicated screen characters are highlighted and saved > > -in a kernel buffer. > > +may be one of the following operations: > > +.RS > > +.TP > > +.B TIOCL_SELCHAR > > +Select character-by-character. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > I would recommend also saying > > > +.TP > > +.B TIOCL_SELWORD > > +Select word-by-word. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > I would recommend also saying something like "The start is expanded backward > and the end is expanded forwards to select entire words." > > > +.TP > > +.B TIOCL_SELLINE > > +Select line-by-line. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > +.RE > > Similarly, mention how the start / end is expanded here too. > > > .IP > > Since Linux 6.7, using this subcode requires the > > .B CAP_SYS_ADMIN > > -- MJF -- <https://www.alejandro-colomar.es/> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection modes 2025-03-02 7:06 ` Alejandro Colomar @ 2025-03-02 19:45 ` Günther Noack 0 siblings, 0 replies; 9+ messages in thread From: Günther Noack @ 2025-03-02 19:45 UTC (permalink / raw) To: Alejandro Colomar; +Cc: Jared Finder, linux-man On Sun, Mar 02, 2025 at 08:06:26AM +0100, Alejandro Colomar wrote: > I have no comments of my own. What do you want to do about the ones > from Jared? Thanks for the reminder! These suggestions all made sense, I replied in-line and sent a V3. –Günther ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for TIOCL_SETSEL selection modes 2025-02-23 23:13 ` Jared Finder 2025-03-02 7:06 ` Alejandro Colomar @ 2025-03-02 19:00 ` Günther Noack 1 sibling, 0 replies; 9+ messages in thread From: Günther Noack @ 2025-03-02 19:00 UTC (permalink / raw) To: Jared Finder; +Cc: Alejandro Colomar, linux-man Hello Jared! On Sun, Feb 23, 2025 at 03:13:35PM -0800, Jared Finder wrote: > I'm not a regular kernel developer, so feel free to ignore my > recommendations if they are not aligned with the level of documentation > usually provided. Thank you! No, it's absolutely appreciated. You are right that the console IOCTLs are generally under-documented. I do not have the time to fix that all up, but I am happy to fix it for the pieces that I'm touching. > On 2025-02-23 13:36, Günther Noack wrote: > > * Indent the documented selection modes into tagged paragraphs. > > * Document constants from the header file (tiocl.h) instead of numbers. > > > > Signed-off-by: Günther Noack <gnoack3000@gmail.com> > > --- > > man/man2const/TIOCLINUX.2const | 23 ++++++++++++++++++----- > > 1 file changed, 18 insertions(+), 5 deletions(-) > > > > diff --git a/man/man2const/TIOCLINUX.2const > > b/man/man2const/TIOCLINUX.2const > > index c0acdd0ea..5db3f6ea6 100644 > > --- a/man/man2const/TIOCLINUX.2const > > +++ b/man/man2const/TIOCLINUX.2const > > @@ -65,11 +65,24 @@ are the ending > > column and row. > > (Upper left corner is row=column=1.) > > .I sel_mode > > -is 0 for character-by-character selection, > > -1 for word-by-word selection, > > -or 2 for line-by-line selection. > > -The indicated screen characters are highlighted and saved > > -in a kernel buffer. > > +may be one of the following operations: > > +.RS > > +.TP > > +.B TIOCL_SELCHAR > > +Select character-by-character. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > I would recommend also saying This sentence is truncated, and there is no special expansion logic in this case. I left it as it is for now, unless there is something better to say here. > > +.TP > > +.B TIOCL_SELWORD > > +Select word-by-word. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > I would recommend also saying something like "The start is expanded backward > and the end is expanded forwards to select entire words." Changing it to Select word-by-word, expanding the selection outwards to align with word boundaries. Does it sound reasonable to you? > > +.TP > > +.B TIOCL_SELLINE > > +Select line-by-line. > > +The indicated screen characters are highlighted > > +and saved in a kernel buffer. > > +.RE > > Similarly, mention how the start / end is expanded here too. Made it Select line-by-line, expanding the selection outwards to select full lines. –Günther ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH man v2 2/2] TIOCLINUX.2const: Document missing TIOCL_SETSEL selection modes 2025-02-23 21:36 [PATCH man v2 0/2] TIOCLINUX.2const: Document TIOCL_SETSEL selection modes Günther Noack 2025-02-23 21:36 ` [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for " Günther Noack @ 2025-02-23 21:36 ` Günther Noack 2025-02-23 23:19 ` Jared Finder 1 sibling, 1 reply; 9+ messages in thread From: Günther Noack @ 2025-02-23 21:36 UTC (permalink / raw) To: Alejandro Colomar Cc: Jared Finder, Günther Noack, linux-man, Hanno Böck, Jann Horn, Jiri Slaby, jwilk Documents the following TIOCL_SETSEL sub-operations: * TIOCL_SELPOINTER * TIOCL_SELCLEAR * TIOCL_SELMOUSEREPORT These previously undocumented selection modes for the Linux console are implemented in drivers/tty/vt/selection.c. The name "selection mode" is slightly misleading as not all of them actually manipulate the kernel's mouse selection buffer. Cc: Jared Finder <jared@finder.org> Cc: Hanno Böck <hanno@hboeck.de> Cc: Jann Horn <jannh@google.com> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: jwilk@jwilk.net Signed-off-by: Günther Noack <gnoack3000@gmail.com> --- man/man2const/TIOCLINUX.2const | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/man/man2const/TIOCLINUX.2const b/man/man2const/TIOCLINUX.2const index 5db3f6ea6..3aa1c7eb2 100644 --- a/man/man2const/TIOCLINUX.2const +++ b/man/man2const/TIOCLINUX.2const @@ -82,6 +82,35 @@ and saved in a kernel buffer. Select line-by-line. The indicated screen characters are highlighted and saved in a kernel buffer. +.TP +.B TIOCL_SELPOINTER +Show the pointer at position +.RI ( xe ,\~ ye ). +.TP +.B TIOCL_SELCLEAR +Remove the current selection highlight, if any, +from the console holding the selection. +.TP +.B TIOCL_SELMOUSEREPORT +Make the terminal report +.RI ( xs ,\~ ys ) +as the current mouse location +using the +.BR xterm (1) +mouse tracking protocol +(see +.BR console_codes (4)). +The lower 4 bits of +.I sel_mode +.RB ( TIOCL_SELBUTTONMASK ) +indicate the desired button press and +modifier key information for the mouse event. +.\" <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Normal-tracking-mode> +.IP +If mouse reporting is not enabled for the terminal, +this operation yields an +.B EINVAL +error. .RE .IP Since Linux 6.7, using this subcode requires the -- 2.48.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 2/2] TIOCLINUX.2const: Document missing TIOCL_SETSEL selection modes 2025-02-23 21:36 ` [PATCH man v2 2/2] TIOCLINUX.2const: Document missing " Günther Noack @ 2025-02-23 23:19 ` Jared Finder 2025-03-02 19:23 ` Günther Noack 0 siblings, 1 reply; 9+ messages in thread From: Jared Finder @ 2025-02-23 23:19 UTC (permalink / raw) To: Günther Noack Cc: Alejandro Colomar, linux-man, Hanno Böck, Jann Horn, Jiri Slaby, jwilk Similarly to the other part of the patch, feel free to ignore my comments if they're not aligned with the usual documentation details. On 2025-02-23 13:36, Günther Noack wrote: > Documents the following TIOCL_SETSEL sub-operations: > > * TIOCL_SELPOINTER > * TIOCL_SELCLEAR > * TIOCL_SELMOUSEREPORT > > These previously undocumented selection modes for the Linux console > are implemented in drivers/tty/vt/selection.c. The name "selection > mode" is slightly misleading as not all of them actually manipulate > the kernel's mouse selection buffer. > > Cc: Jared Finder <jared@finder.org> > Cc: Hanno Böck <hanno@hboeck.de> > Cc: Jann Horn <jannh@google.com> > Cc: Jiri Slaby <jirislaby@kernel.org> > Cc: jwilk@jwilk.net > Signed-off-by: Günther Noack <gnoack3000@gmail.com> > --- > man/man2const/TIOCLINUX.2const | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/man/man2const/TIOCLINUX.2const > b/man/man2const/TIOCLINUX.2const > index 5db3f6ea6..3aa1c7eb2 100644 > --- a/man/man2const/TIOCLINUX.2const > +++ b/man/man2const/TIOCLINUX.2const > @@ -82,6 +82,35 @@ and saved in a kernel buffer. > Select line-by-line. > The indicated screen characters are highlighted > and saved in a kernel buffer. > +.TP > +.B TIOCL_SELPOINTER > +Show the pointer at position > +.RI ( xe ,\~ ye ). nit: Technically, "at the greater position of start or end". See how ps and pe are swapped if ps > pe in vc_selection(). > +.TP > +.B TIOCL_SELCLEAR > +Remove the current selection highlight, if any, > +from the console holding the selection. I'd recommend stating explicitly if this affects the stored characters. (I believe it does not.) > +.TP > +.B TIOCL_SELMOUSEREPORT > +Make the terminal report > +.RI ( xs ,\~ ys ) > +as the current mouse location > +using the > +.BR xterm (1) > +mouse tracking protocol > +(see > +.BR console_codes (4)). > +The lower 4 bits of > +.I sel_mode > +.RB ( TIOCL_SELBUTTONMASK ) > +indicate the desired button press and > +modifier key information for the mouse event. > +.\" > <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Normal-tracking-mode> > +.IP > +If mouse reporting is not enabled for the terminal, > +this operation yields an > +.B EINVAL > +error. > .RE > .IP > Since Linux 6.7, using this subcode requires the -- MJF ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH man v2 2/2] TIOCLINUX.2const: Document missing TIOCL_SETSEL selection modes 2025-02-23 23:19 ` Jared Finder @ 2025-03-02 19:23 ` Günther Noack 0 siblings, 0 replies; 9+ messages in thread From: Günther Noack @ 2025-03-02 19:23 UTC (permalink / raw) To: Jared Finder Cc: Alejandro Colomar, linux-man, Hanno Böck, Jann Horn, Jiri Slaby, jwilk Hello! On Sun, Feb 23, 2025 at 03:19:02PM -0800, Jared Finder wrote: > On 2025-02-23 13:36, Günther Noack wrote: > > man/man2const/TIOCLINUX.2const | 29 +++++++++++++++++++++++++++++ > > 1 file changed, 29 insertions(+) > > > > diff --git a/man/man2const/TIOCLINUX.2const > > b/man/man2const/TIOCLINUX.2const > > index 5db3f6ea6..3aa1c7eb2 100644 > > --- a/man/man2const/TIOCLINUX.2const > > +++ b/man/man2const/TIOCLINUX.2const > > @@ -82,6 +82,35 @@ and saved in a kernel buffer. > > Select line-by-line. > > The indicated screen characters are highlighted > > and saved in a kernel buffer. > > +.TP > > +.B TIOCL_SELPOINTER > > +Show the pointer at position > > +.RI ( xe ,\~ ye ). > > nit: Technically, "at the greater position of start or end". See how ps and > pe are swapped if ps > pe in vc_selection(). Thanks, that is a good point, I had missed that. I happens at a central place in the code, where it technically affects all operations except for TIOCL_SELMOUSEREPORT, but it only makes a difference in the documentation of TIOCL_SELPOINTER. > > +.TP > > +.B TIOCL_SELCLEAR > > +Remove the current selection highlight, if any, > > +from the console holding the selection. > > I'd recommend stating explicitly if this affects the stored characters. (I > believe it does not.) Thanks, added. –Günther ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-03-02 19:45 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-23 21:36 [PATCH man v2 0/2] TIOCLINUX.2const: Document TIOCL_SETSEL selection modes Günther Noack 2025-02-23 21:36 ` [PATCH man v2 1/2] TIOCLINUX.2const: Restructure documentation for " Günther Noack 2025-02-23 23:13 ` Jared Finder 2025-03-02 7:06 ` Alejandro Colomar 2025-03-02 19:45 ` Günther Noack 2025-03-02 19:00 ` Günther Noack 2025-02-23 21:36 ` [PATCH man v2 2/2] TIOCLINUX.2const: Document missing " Günther Noack 2025-02-23 23:19 ` Jared Finder 2025-03-02 19:23 ` Günther Noack
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox