Add optional full_window argument to TuiWindow.write
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/ChangeLog: 2021-05-27 Hannes Domani <ssbssa@yahoo.de> * python/py-tui.c (tui_py_window::output): Add full_window argument. (gdbpy_tui_write): Parse "full_window" argument. gdb/doc/ChangeLog: 2021-05-27 Hannes Domani <ssbssa@yahoo.de> * python.texi (TUI Windows In Python): Document "full_window" argument.
This commit is contained in:
parent
d5a6313e1c
commit
bdef572304
4 changed files with 30 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2021-05-27 Hannes Domani <ssbssa@yahoo.de>
|
||||||
|
|
||||||
|
* python/py-tui.c (tui_py_window::output): Add full_window
|
||||||
|
argument.
|
||||||
|
(gdbpy_tui_write): Parse "full_window" argument.
|
||||||
|
|
||||||
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
|
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* make-init-c: Add option to reverse function calls.
|
* make-init-c: Add option to reverse function calls.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2021-05-27 Hannes Domani <ssbssa@yahoo.de>
|
||||||
|
|
||||||
|
* python.texi (TUI Windows In Python): Document "full_window"
|
||||||
|
argument.
|
||||||
|
|
||||||
2021-05-27 Hannes Domani <ssbssa@yahoo.de>
|
2021-05-27 Hannes Domani <ssbssa@yahoo.de>
|
||||||
|
|
||||||
* python.texi (Symbols In Python): Document gdb.SYMBOL_LOC_LABEL.
|
* python.texi (Symbols In Python): Document gdb.SYMBOL_LOC_LABEL.
|
||||||
|
|
|
@ -5959,10 +5959,14 @@ displayed above the window. This attribute can be modified.
|
||||||
Remove all the contents of the window.
|
Remove all the contents of the window.
|
||||||
@end defun
|
@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
|
Write @var{string} to the window. @var{string} can contain ANSI
|
||||||
terminal escape styling sequences; @value{GDBN} will translate these
|
terminal escape styling sequences; @value{GDBN} will translate these
|
||||||
as appropriate for the terminal.
|
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
|
@end defun
|
||||||
|
|
||||||
The factory function that you supply should return an object
|
The factory function that you supply should return an object
|
||||||
|
|
|
@ -111,8 +111,9 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write STR to the window. */
|
/* Write STR to the window. FULL_WINDOW is true to erase the window
|
||||||
void output (const char *str);
|
contents beforehand. */
|
||||||
|
void output (const char *str, bool full_window);
|
||||||
|
|
||||||
/* A helper function to compute the viewport width. */
|
/* A helper function to compute the viewport width. */
|
||||||
int viewport_width () const
|
int viewport_width () const
|
||||||
|
@ -229,12 +230,18 @@ tui_py_window::do_scroll_vertical (int num_to_scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tui_py_window::output (const char *text)
|
tui_py_window::output (const char *text, bool full_window)
|
||||||
{
|
{
|
||||||
if (m_inner_window != nullptr)
|
if (m_inner_window != nullptr)
|
||||||
{
|
{
|
||||||
|
if (full_window)
|
||||||
|
werase (m_inner_window.get ());
|
||||||
|
|
||||||
tui_puts (text, 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 ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,13 +412,14 @@ gdbpy_tui_write (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
gdbpy_tui_window *win = (gdbpy_tui_window *) self;
|
gdbpy_tui_window *win = (gdbpy_tui_window *) self;
|
||||||
const char *text;
|
const char *text;
|
||||||
|
int full_window = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple (args, "s", &text))
|
if (!PyArg_ParseTuple (args, "s|i", &text, &full_window))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
REQUIRE_WINDOW (win);
|
REQUIRE_WINDOW (win);
|
||||||
|
|
||||||
win->window->output (text);
|
win->window->output (text, full_window);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue