public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Balazs Kezes <rlblaster@gmail.com>
Subject: Re: [patch] Slightly better resize support in TUI mode
Date: Tue, 20 Jul 2010 15:42:00 -0000	[thread overview]
Message-ID: <201007201642.37113.pedro@codesourcery.com> (raw)
In-Reply-To: <AANLkTimYBE7rXgsBOCxuiuqh702y9abN6AhEdSDBdHQe@mail.gmail.com>

Thanks for taking the time to work on the TUI.  I personally
appreciate it, being a TUI user myself.

On Monday 19 July 2010 22:20:38, Balazs Kezes wrote:

> First of all we need to make sure that readline works with correct screen
> sizes. When readline is not echoing it doesn't update its internal variables
> about the screen size. This is an issue because TUI uses curses functions to
> echo a character back so readline is in noecho mode. Here's the patch for that:
> 
> Changelog
> 
> 2010-07-19 Balazs Kezes (rlblaster@gmail.com)
> 
> 	* terminal.c (rl_resize_terminal): Make sure terminal size is updated
> 	even when readline is not echoing.

We don't maintain readline ourselves (although we do have a few local
patches, we much prefer not carrying them).  Could you check
whether this code has changed in more recent readline's than the one
we have in our tree, and submit this to readline upstream if not?
(we were recently talking about updating readline right after 7.2 branches,
and the the branching already happened, though the update hasn't yet).  In
any case, we also support building gdb against the system readline,
which again suggests that it is much better to have the fix upstream.

> The other issue is that 

(...)

(it is usually better to have each separate problem, and especially,
each patch submitted as a separate email.)

> in TUI's SIGWINCH handler the resize code is not
> called at all. In the resize code you need to call resize_term which is
> ncurses function in order to update its internal structures. This was placed
> into a #ifdef HAVE_RESIZE_TERM but I have not found any references to that
> macro so I removed the it. Also it seems to me that wresize is not called for
> the command window so I added a call to it too.

It sounds like the intent was to add an autoconf check for resize_term (so
that HAVE_RESIZE_TERM would appear in build/gdb/config.h):
  <http://linux.die.net/man/3/resize_term>
mentions that this is an extension.

> 
> *************** tui_sigwinch_handler (int signal)
> *** 817,822 ****
> --- 820,831 ----
>     /* Say that a resize was done so that the readline can do it later
>        when appropriate.  */
>     tui_set_win_resized_to (TRUE);
> +
> +   if (tui_active)
> +     {
> +       tui_resize_all ();
> +       tui_refresh_all_win ();
> +     }
>   }
>   #endif
> 

It's best to avoid doing non async signal safe work in the signal
handler.  Instead, set a global flag, and have the main code
handle the resize.  This is what the tui_set_win_resized_to
call shown above is doing -- setting the flag.  But, it sounds
like in this scenario, nobody's reacting to the flag.  That's
what we should fix.

-- 
Pedro Alves

  reply	other threads:[~2010-07-20 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19 21:20 Balazs Kezes
2010-07-20 15:42 ` Pedro Alves [this message]
2010-07-20 21:15   ` Balazs Kezes

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=201007201642.37113.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rlblaster@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).