Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PING][PATCH v2] Fix multi-line strings in TuiWindow.write
       [not found] <1529224928.468621.1607091529134.ref@mail.yahoo.com>
@ 2020-12-04 14:18 ` Hannes Domani via Gdb-patches
  2020-12-04 17:22   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Domani via Gdb-patches @ 2020-12-04 14:18 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PING][PATCH v2] Fix multi-line strings in TuiWindow.write
  2020-12-04 14:18 ` [PING][PATCH v2] Fix multi-line strings in TuiWindow.write Hannes Domani via Gdb-patches
@ 2020-12-04 17:22   ` Simon Marchi
  2020-12-04 18:23     ` Hannes Domani via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-12-04 17:22 UTC (permalink / raw)
  To: Hannes Domani, gdb-patches


On 2020-12-04 9:18 a.m., Hannes Domani via Gdb-patches wrote:
> 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

I tried to apply this and give it a try (although I know nothing about
this code), and it looks like the patch is based on an old commit.  This
code was changed in September, quite a bit before your original patch:

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=149830c137f351cb41888f87493cc42a72dbeac7;hp=5f278258ccae6a666c72de709a3171975fbaeb05

Can you see if the issue still exists in current master?  And if so, the
fix will have to be adapted to the new code.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PING][PATCH v2] Fix multi-line strings in TuiWindow.write
  2020-12-04 17:22   ` Simon Marchi
@ 2020-12-04 18:23     ` Hannes Domani via Gdb-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Domani via Gdb-patches @ 2020-12-04 18:23 UTC (permalink / raw)
  To: gdb-patches, Simon Marchi

 Am Freitag, 4. Dezember 2020, 18:22:02 MEZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-12-04 9:18 a.m., Hannes Domani via Gdb-patches wrote:
> > 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
>
>
> I tried to apply this and give it a try (although I know nothing about
> this code), and it looks like the patch is based on an old commit.  This
> code was changed in September, quite a bit before your original patch:
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=149830c137f351cb41888f87493cc42a72dbeac7;hp=5f278258ccae6a666c72de709a3171975fbaeb05

Oh, I forgot to cherry pick it to current master, sorry about that.


> Can you see if the issue still exists in current master?  And if so, the
> fix will have to be adapted to the new code.

Yes, looks like this is probably fixed.
I'll re-check when I build current master the next time.


Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-04 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1529224928.468621.1607091529134.ref@mail.yahoo.com>
2020-12-04 14:18 ` [PING][PATCH v2] Fix multi-line strings in TuiWindow.write Hannes Domani via Gdb-patches
2020-12-04 17:22   ` Simon Marchi
2020-12-04 18:23     ` Hannes Domani via Gdb-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox