public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 12/22] Add optional full_window argument to TuiWindow.write
Date: Sat,  6 Mar 2021 18:40:52 +0100	[thread overview]
Message-ID: <20210306174102.21597-3-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210306174102.21597-1-ssbssa@yahoo.de>

To prevent flickering when first calling erase, then write, this new
argument indicates that the passed string contains the full contents of
the window.  This fills every unused cell of the window with a space, so
it's not necessary to call erase beforehand.
---
 gdb/doc/python.texi |  6 +++++-
 gdb/python/py-tui.c | 17 ++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 565e87d0784..0e613d564e5 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5876,10 +5876,14 @@ displayed above the window.  This attribute can be modified.
 Remove all the contents of the window.
 @end defun
 
-@defun TuiWindow.write (@var{string})
+@defun TuiWindow.write (@var{string} @r{[}, @var{full_window}@r{]})
 Write @var{string} to the window.  @var{string} can contain ANSI
 terminal escape styling sequences; @value{GDBN} will translate these
 as appropriate for the terminal.
+
+If the @var{full_window} parameter is @code{True}, then @var{string}
+contains the full contents of the window.  This is similar to calling
+@code{erase} before @code{write}, but avoids the flickering.
 @end defun
 
 The factory function that you supply should return an object
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 02dcd6949df..e0522f65a99 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -114,7 +114,7 @@ class tui_py_window : public tui_win_info
   }
 
   /* Write STR to the window.  */
-  void output (const char *str);
+  void output (const char *str, bool full_window);
 
   /* A helper function to compute the viewport width.  */
   int viewport_width () const
@@ -246,12 +246,18 @@ tui_py_window::click (int mouse_x, int mouse_y, int mouse_button)
 }
 
 void
-tui_py_window::output (const char *text)
+tui_py_window::output (const char *text, bool full_window)
 {
   if (m_inner_window != nullptr)
     {
+      if (full_window)
+	werase (m_inner_window.get ());
+
       tui_puts (text, m_inner_window.get ());
-      tui_wrefresh (m_inner_window.get ());
+      if (full_window)
+	check_and_display_highlight_if_needed ();
+      else
+	tui_wrefresh (m_inner_window.get ());
     }
 }
 
@@ -422,13 +428,14 @@ gdbpy_tui_write (PyObject *self, PyObject *args)
 {
   gdbpy_tui_window *win = (gdbpy_tui_window *) self;
   const char *text;
+  int full_window = 0;
 
-  if (!PyArg_ParseTuple (args, "s", &text))
+  if (!PyArg_ParseTuple (args, "s|i", &text, &full_window))
     return nullptr;
 
   REQUIRE_WINDOW (win);
 
-  win->window->output (text);
+  win->window->output (text, full_window);
 
   Py_RETURN_NONE;
 }
-- 
2.30.1


  parent reply	other threads:[~2021-03-06 17:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210306174102.21597-1-ssbssa.ref@yahoo.de>
2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
2021-03-06 17:40   ` [PATCH 11/22] Use styled argument of gdb.execute() for cccw command Hannes Domani
2021-03-06 17:40   ` Hannes Domani [this message]
2021-03-06 18:13     ` [PATCH 12/22] Add optional full_window argument to TuiWindow.write Eli Zaretskii
2021-03-11 21:49     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 13/22] Use the full_window argument of TuiWindow.write to prevent flickering Hannes Domani
2021-03-06 17:40   ` [PATCH 14/22] Add set_tui_auto_display python function Hannes Domani
2021-03-06 17:40   ` [PATCH 15/22] Disable automatic display while the display window is active Hannes Domani
2021-03-06 17:40   ` [PATCH 16/22] Show raw flag in info display Hannes Domani
2021-03-06 17:40   ` [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers Hannes Domani
2021-03-11 21:47     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 18/22] Update the source location with Frame.select Hannes Domani
2021-03-11 21:53     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 19/22] Refresh the TUI source window when changing the frame in the frame window Hannes Domani
2021-03-06 18:13   ` [PATCH 10/22] Add optional styled argument to gdb.execute Eli Zaretskii
2021-03-08 10:01   ` Andrew Burgess

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=20210306174102.21597-3-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@sourceware.org \
    /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).