[PING][PATCH v2] Fix multi-line strings in TuiWindow.write

Hannes Domani ssbssa@yahoo.de
Fri Dec 4 14:18:49 GMT 2020


Ping.

Am Freitag, 20. November 2020, 01:01:43 MEZ hat Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> Folgendes geschrieben:

> Currently multi-line strings are all written to the first line.
>
> Since tui_copy_source_line sets the text variable to the start of the
> next line, the check for newline has to be done with the previous character.
>
> gdb/ChangeLog:
>
> 2020-11-19  Hannes Domani  <ssbssa@yahoo.de>
>
>     * python/py-tui.c (tui_py_window::output): Fix multi-line strings.
> ---
> v2:
> - Don't break multiple TuiWindow.write calls without newline characters.
> ---
> gdb/python/py-tui.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
> index 95c71f1d2d..306bd7b801 100644
> --- a/gdb/python/py-tui.c
> +++ b/gdb/python/py-tui.c
> @@ -203,13 +203,13 @@ tui_py_window::output (const char *text)
>     {
>       wmove (handle.get (), cursor_y + 1, cursor_x + 1);
>
> +      const char *prev_text = text;
>       std::string line = tui_copy_source_line (&text, 0, 0,
>                           vwidth - cursor_x, 0);
>       tui_puts (line.c_str (), handle.get ());
>
> -      if (*text == '\n')
> +      if (text > prev_text && (text[-1] == '\n' || text[-1] == '\r'))
>     {
> -      ++text;
>       ++cursor_y;
>       cursor_x = 0;
>     }
> --
> 2.29.2


More information about the Gdb-patches mailing list