public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: strager <strager.nds@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/tui: add 'set tui mouse-events off' to restore mouse selection
Date: Sat, 28 Jan 2023 10:35:38 +0200	[thread overview]
Message-ID: <838rhnawf9.fsf@gnu.org> (raw)
In-Reply-To: <CAC-ggsEszq2WX7eZ_UdvgaBtM1YdnBFyJstr4Z0=BNW6VcMEEQ@mail.gmail.com> (message from strager via Gdb-patches on Fri, 27 Jan 2023 16:42:58 -0800)

> Date: Fri, 27 Jan 2023 16:42:58 -0800
> From: strager via Gdb-patches <gdb-patches@sourceware.org>
> 
> Rationale:
> I use the mouse with my terminal to select and copy text. In gdb, I use
> the mouse to select a function name to set a breakpoint, or a variable
> name to print, for example.
> 
> When gdb is compiled with ncurses mouse support, gdb's TUI mode
> intercepts mouse events. Left-clicking and dragging, which would
> normally select text, seems to do nothing. This means I cannot select
> text using my mouse anymore. This makes it harder to set breakpoints,
> print variables, etc.
> 
> Solution:
> I tried to fix this issue by editing the 'mousemask' call to only enable
> buttons 4 and 5. However, this still caused my terminal (gnome-terminal)
> to not allow text to be selected. The only way I could make it work is
> by calling 'mousemask (0, NULL);'. But doing so disables the mouse code
> entirely, which other people might want.
> 
> I therefore decided to make a setting in gdb called 'tui mouse-events'.
> If enabled (the default), the behavior is as it is now: terminal mouse
> events are given to gdb, disabling the terminal's default behavior.
> If disabled (opt-in), the behavior is as it was before the year 2020:
> terminal mouse events are not given to gdb, therefore the mouse can be
> used to select and copy text.

Thanks.

> --- gdb/NEWS
> +++ gdb/NEWS
> @@ -17,6 +17,13 @@ maintenance print record-instruction [ N ]
>    prints how GDB would undo the N-th previous instruction, and if N is
>    positive, it prints how GDB will redo the N-th following instruction.
> 
> +set tui mouse-events [on|off]
> +show tui mouse-events
> +  When on (default), the TUI will interpret mouse clicks (including
> scroll wheel
> +  presses), overwriting the terminal's default behavior (usually text
> +  selection). When off, the TUI will preserve the terminal's default behavior
> +  for mouse events.

Instead of talking about overriding the terminal's behavior, this text
should say that the mouse events are interpreted either by GDB or by
the terminal.

> +Set whether the TUI source window is displayed in ``compact'' form.
> +The default display uses more space for line numbers and starts the
> +source text at the next tab stop; the compact display uses only as
> +much space as is needed for the line numbers in the current file, and
> +only a single space to separate the line numbers from the source.

This part sounds unrelated?

  reply	other threads:[~2023-01-28  8:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  0:42 strager
2023-01-28  8:35 ` Eli Zaretskii [this message]
2023-02-01  8:35   ` strager
2023-02-01 12:41     ` Eli Zaretskii
2023-02-01 13:27     ` Andrew Burgess
2023-02-02  1:08       ` strager
2023-02-02  7:18         ` Eli Zaretskii
2023-02-02 19:50         ` Pedro Alves
2023-02-02 19:59           ` strager
2023-09-14  8:05             ` strager
2023-09-20 15:39               ` Pedro Alves
2023-02-02  9:33 ` Lancelot SIX
2023-02-02 11:11   ` strager

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838rhnawf9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=strager.nds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).