diff options
author | Matthew "strager" Glazar <strager.nds@gmail.com> | 2023-01-27 16:19:45 -0800 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2023-09-20 16:35:36 +0100 |
commit | 0f6a69947891fc448c37e944d6c3e266621d35a8 (patch) | |
tree | 24fabc6ae9aeb340b42ae5d6a9c495111d7a71a6 /gdb/tui/tui-command.c | |
parent | 973db6fae304c2bcafff5f169610f663adc9e817 (diff) | |
download | gdb-0f6a69947891fc448c37e944d6c3e266621d35a8.zip gdb-0f6a69947891fc448c37e944d6c3e266621d35a8.tar.gz gdb-0f6a69947891fc448c37e944d6c3e266621d35a8.tar.bz2 |
gdb/tui: add 'set tui mouse-events off' to restore mouse selection
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.
Notes:
I am not attached to the setting name or its description. Feel free to
suggest better wording.
Testing:
I tested this change in gnome-terminal by performing the following steps
manually:
1. Run: gdb --args ./myprogram
2. Enable TUI: press ctrl-x ctrl-a
3. Click and drag text with the mouse. Observe no selection.
4. Input: set tui mouse-events off
5. Click and drag text with the mouse. Observe that selection works now.
6. Input: set tui mouse-events on.
7. Click and drag text with the mouse. Observe no selection.
Diffstat (limited to 'gdb/tui/tui-command.c')
0 files changed, 0 insertions, 0 deletions