[PATCH 2/2] Fix multi-line strings in TuiWindow.write

Hannes Domani ssbssa@yahoo.de
Thu Nov 19 23:33:06 GMT 2020


 Am Donnerstag, 19. November 2020, 17:06:51 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 extra check for '\n' is wrong and unnecessary.
>
> gdb/ChangeLog:
>
> 2020-11-19  Hannes Domani  <ssbssa@yahoo.de>
>
>     * python/py-tui.c (tui_py_window::output): Fix multi-line strings.
> ---
> gdb/python/py-tui.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
> index 95c71f1d2d..8054363e16 100644
> --- a/gdb/python/py-tui.c
> +++ b/gdb/python/py-tui.c
> @@ -207,14 +207,8 @@ tui_py_window::output (const char *text)
>                           vwidth - cursor_x, 0);
>       tui_puts (line.c_str (), handle.get ());
>
> -      if (*text == '\n')
> -    {
> -      ++text;
> -      ++cursor_y;
> -      cursor_x = 0;
> -    }
> -      else
> -    cursor_x = getcurx (handle.get ()) - 1;
> +      ++cursor_y;
> +      cursor_x = 0;
>     }
>
>   wrefresh (handle.get ());
>
> --
> 2.29.2

I just now noticed that this change breaks the case when TuiWindow.write is
called multiple times without any linebreak, so this puts each text on a
new line even though it should all be on the same line.

So please ignore this patch, I will resend a proper fix soon.


Hannes


More information about the Gdb-patches mailing list