Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
To: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>,
	 Tom Tromey <tom@tromey.com>, Pedro Alves <pedro@palves.net>
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH v3] Make the TUI command window support the mouse
Date: Sun, 13 Jun 2021 17:55:00 +0000 (UTC)	[thread overview]
Message-ID: <2109712188.9612122.1623606900952@mail.yahoo.com> (raw)
In-Reply-To: <25580f20-76bc-4fd0-8426-5474d5ed5d22@palves.net>

 Am Sonntag, 13. Juni 2021, 19:26:00 MESZ hat Pedro Alves <pedro@palves.net> Folgendes geschrieben:

> On 2021-06-13 2:04 p.m., Hannes Domani wrote:
> >  Am Sonntag, 13. Juni 2021, 04:46:15 MESZ hat Pedro Alves <pedro@palves.net> Folgendes geschrieben:
> >
> > This is great, thank you for doing this.
> >
> > I just tried it, and I had just one problem, see below.
> >
>
> >> +      /* For the standard keys, we can find them efficiently in the
> >> +    key_xxx macros, defined by ncurses.  We could also hardcode
> >> +    sequences readline understands, and/or use rl_get_termcap.
> >> +    See readline/readline.c:bind_arrow_keys_internal for
> >> +    hardcoded sequences.  */
> >> +      switch (ch)
> >> +    {
> >> +    case KEY_NPAGE: /* page down */
> >> +      return start_sequence (key_npage);
> >> +    case KEY_PPAGE: /* page up */
> >> +      return start_sequence (key_ppage);
> >> +    case KEY_DOWN:
> >> +      return start_sequence (key_down);
> >> +    case KEY_UP:
> >> +      return start_sequence (key_up);
> >> +    case KEY_RIGHT:
> >> +      return start_sequence (key_right);
> >> +    case KEY_LEFT:
> >> +      return start_sequence (key_left);
> >> +    case KEY_HOME:
> >> +      return start_sequence (key_home);
> >> +    case KEY_END:
> >> +      return start_sequence (key_end);
> >> +    case KEY_DC: /* del */
> >> +      return start_sequence (key_dc);
> >> +    case KEY_IC: /* ins */
> >> +      return start_sequence (key_ic);
> >> +    }
> >
> > PDcurses doesn't have these key_npage/key_ppage/key_down/... variables,
> > so I had to use the hardcoded sequences as you described.
> > This is working for the arrow keys and home/end, and for del I used '\004'
> > instead, but I didn't see any for page up/down and ins.
>
> Ack.  \004 is ctrl-d  ('d' & 0x1f).  I'm a bit wary of hardcoding it,
> since I imagine there might be some users out where that have bound
> ctrl-d to some other action in their inputrc.
>
> readline's bind_arrow_keys_internal has:
>
> #if defined (__MINGW32__)
>   rl_bind_keyseq_if_unbound ("\340H", rl_get_previous_history);
>   rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history);
>   rl_bind_keyseq_if_unbound ("\340M", rl_forward_char);
>   rl_bind_keyseq_if_unbound ("\340K", rl_backward_char);
>   rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line);
>   rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line);
>   rl_bind_keyseq_if_unbound ("\340S", rl_delete);
>   rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode);
>
>   /* These may or may not work because of the embedded NUL. */
>   rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history);
>   rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history);
>   rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char);
>   rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char);
>   rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line);
>   rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line);
>   rl_bind_keyseq_if_unbound ("\\000S", rl_delete);
>   rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode);
> #endif
>
> So would "\340S" and "\340R" work instead?  See attached patch.
>
> >
> > I'm not sure if it's even a problem for page up/down, they seem to not be used
> > by readline, but I couldn't make ins work.
>
> Ins works for me on konsole, and on a linux virtual console.  It does not work
> on xterm and rxvt.  Nor on konsole + ssh.  Nor under screen.  I confirmed that
> I get the same key sequence for the insert key on all those cases (run "cat" + press
> the key).  It's the same with bash and gdb in non-tui mode.  It's not specific to this
> patch.  I would guess readline is somehow finding that the terminal does not support
> overwrite mode.
>
> >
> > And rl_get_termcap returned for everything except "le" NULL, but I assume
> > that's just how it is on Windows.
>
> Unfortunate.
>
> Here's a new version.  Does this one work for you?

Yes, with this everything works, thanks.


Hannes

  reply	other threads:[~2021-06-13 17:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210603151453.15248-1-ssbssa.ref@yahoo.de>
2021-06-03 15:14 ` [PATCHv3 1/2] Initial TUI mouse support Hannes Domani via Gdb-patches
2021-06-03 15:14   ` [PATCHv3 2/2] Forward mouse click to python TUI window Hannes Domani via Gdb-patches
2021-06-03 17:16     ` Eli Zaretskii via Gdb-patches
2021-06-04 13:52     ` Tom Tromey
2021-06-04 13:51   ` [PATCHv3 1/2] Initial TUI mouse support Tom Tromey
2021-06-04 14:21     ` Hannes Domani via Gdb-patches
2021-06-04 15:20       ` Pedro Alves
2021-06-04 16:06         ` Hannes Domani via Gdb-patches
2021-06-04 16:23           ` Pedro Alves
2021-06-04 18:59             ` Eli Zaretskii via Gdb-patches
2021-06-04 18:57           ` Eli Zaretskii via Gdb-patches
2021-06-04 16:29         ` Pedro Alves
2021-06-04 16:48           ` Hannes Domani via Gdb-patches
2021-06-04 18:05             ` Joel Brobecker
2021-06-04 18:13           ` Simon Marchi via Gdb-patches
2021-06-04 18:39             ` Joel Brobecker
2021-06-04 20:31             ` Pedro Alves
2021-06-04 20:43               ` Pedro Alves
2021-06-04 21:15               ` Hannes Domani via Gdb-patches
2021-06-04 22:19                 ` Pedro Alves
2021-06-10 18:44               ` Tom Tromey
2021-06-13 17:26                 ` Pedro Alves
2021-06-18 15:01                   ` Tom Tromey
2021-06-18 17:42                     ` Pedro Alves
2021-06-04 18:46           ` Tom Tromey
2021-06-04 20:54             ` Pedro Alves
2021-06-04 23:48               ` Pedro Alves
2021-06-05 14:40                 ` Hannes Domani via Gdb-patches
2021-06-06  5:46                   ` Eli Zaretskii via Gdb-patches
2021-06-10 18:46                   ` Tom Tromey
2021-06-11 11:02                     ` Hannes Domani via Gdb-patches
2021-06-12  2:41                       ` POC: Make the TUI command window support the mouse (Re: [PATCHv3 1/2] Initial TUI mouse support) Pedro Alves
2021-06-12 12:32                         ` Hannes Domani via Gdb-patches
2021-06-12 18:08                           ` Pedro Alves
2021-06-13  2:46                             ` [PATCH v2] Make the TUI command window support the mouse Pedro Alves
2021-06-13 10:35                               ` Eli Zaretskii via Gdb-patches
2021-06-13 17:29                                 ` Pedro Alves
2021-06-13 18:02                                   ` Eli Zaretskii via Gdb-patches
2021-06-13 18:13                                     ` Pedro Alves
2021-06-13 13:04                               ` Hannes Domani via Gdb-patches
2021-06-13 17:25                                 ` [PATCH v3] " Pedro Alves
2021-06-13 17:55                                   ` Hannes Domani via Gdb-patches [this message]
2021-06-13 17:59                                     ` Pedro Alves
2021-06-17 11:04                                       ` [PUSHED v4] " Pedro Alves

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=2109712188.9612122.1623606900952@mail.yahoo.com \
    --to=gdb-patches@sourceware.org \
    --cc=brobecker@adacore.com \
    --cc=pedro@palves.net \
    --cc=ssbssa@yahoo.de \
    --cc=tom@tromey.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