Re: [PATCHv3 1/2] Initial TUI mouse support

Hannes Domani via Gdb-patches
2021-06-04T21:16:10Z

Am Freitag, 4. Juni 2021, 22:31:31 MESZ hat Pedro Alves <pedro@palves.net> Folgendes geschrieben:

> On 2021-06-04 7:13 p.m., Simon Marchi wrote:
> > On 2021-06-04 12:29 p.m., Pedro Alves wrote:
> >> The trouble is that now pressing anywhere on the screen with the mouse just results in
> >> weird characters being printed on the command line window (probably uninterpreted control
> >> sequences).  That even prevents me from selecting text (something I do often) -- I wanted to do
> >> that to paste the results here.  I even tried suspending GDB with ^Z to then copy the text, but
> >> that still leaves the mouse messed up.  See this screenshot:
> >>
> >>  https://i.imgur.com/bO7FKDO.png
> >>
> >> This was on Ubuntu 20.04.
> >
> > Obviously the printing random characters is bad.  But it's possible that
> > the not being able to select text is normal, as the application (GDB)
> > now supports mouse events.  In some terminal emulators, you can press
> > shift while you click to say "I really want to select the display
> > characters, not send mouse events to the program".
>
> I'm on my Fedora 32 laptop currently, and here it works fine.
>
> You can select text without having press any key.  It basically works
> as before.  I suppose we could teach GDB to be smarter about text selection -- like,
> if you select several lines of source code in the TUI source window, ideally
> we'd select just the source code, instead of the source code plus the window
> borders, etc.  Then we would have an "escape" key to be able to disable special
> mouse mode so you can select text in the whole terminal using regular text
> terminal selection, and I suppose that that's what "shift" does in those programs
> you mention.
>
> I'm surprised to find that clicking a window doesn't set focus on it, though.
> Is that supposed to work?

No, that's not implemented.
I was thinking about it, but wasn't sure what people prefer.
So I just kept the simpler variant.

Hannes