public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
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: Thu, 2 Feb 2023 09:33:22 +0000	[thread overview]
Message-ID: <20230202092950.tpxei5w4meutjeiv@ubuntu.lan> (raw)
In-Reply-To: <CAC-ggsEszq2WX7eZ_UdvgaBtM1YdnBFyJstr4Z0=BNW6VcMEEQ@mail.gmail.com>

Hi,

Thanks for working on this!  I think I got used to use the "shift" key
when I try to select, but soon might soon have "set tui mouse-events
off" in my rc file.

I have some code formatting remarks:

  -  In GDB codebase, we use tab for indentation[1]:

      Lines should be indented with a mix of tabs and spaces.  8 spaces
      should be replaced with Tab.

      It looks like you patch uses spaces for indentation.

  -GDB prefers "nullptr" instead of "NULL".

I have inlined in the patch below where this is relevant.

Otherwise, and for what this is worth (I am not a maintainer), the change
looks reasonable to me.

Best,
Lancelot.

[1] https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Code_indentation

> diff --git gdb/tui/tui-win.c gdb/tui/tui-win.c
> index 008189eb99b..5709bfcbac1 100644
> --- gdb/tui/tui-win.c
> +++ gdb/tui/tui-win.c
> @@ -897,6 +897,17 @@ tui_show_compact_source (struct ui_file *file,
> int from_tty,
>    gdb_printf (file, _("TUI source window compactness is %s.\n"), value);
>  }
> 
> +bool tui_enable_mouse = true;
> +
> +/* Implement 'show tui mouse-events'.  */
> +
> +static void
> +show_tui_mouse_events (struct ui_file *file, int from_tty,
> +               struct cmd_list_element *c, const char *value)

Use tabs here.

> +{
> +  gdb_printf (file, _("TUI mouse events is %s.\n"), value);
> +}
> +
>  /* Set the tab width of the specified window.  */
>  static void
>  tui_set_tab_width_command (const char *arg, int from_tty)
> @@ -1284,6 +1295,19 @@ position indicator is styled."),
>                 &style_set_list,
>                 &style_show_list);
> 
> +  add_setshow_boolean_cmd ("mouse-events", class_tui,
> +               &tui_enable_mouse, _("\

Same

> +Set whether TUI mode handles mouse clicks."), _("\
> +Show whether TUI mode handles mouse clicks."), _("\
> +When on, the TUI will interpret mouse clicks (including scroll wheel
> presses),\n\
> +overwriting the terminal's default behavior (usually text selection).\n\
> +When off, the TUI will preserve the terminal's default behavior for mouse\n\
> +events."),
> +

Extra empty line here could be removed.

> +               NULL,

s/NULL/nullptr/

> +               show_tui_mouse_events,
> +               &tui_setlist, &tui_showlist);

and tabs instead of spaces for the above lines.

> +
>    tui_border_style.changed.attach (tui_rehighlight_all, "tui-win");
>    tui_active_border_style.changed.attach (tui_rehighlight_all, "tui-win");
>  }

  parent reply	other threads:[~2023-02-02  9:33 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
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 [this message]
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=20230202092950.tpxei5w4meutjeiv@ubuntu.lan \
    --to=lsix@lancelotsix.com \
    --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).