Re: [PATCH] Fix scrolling right in the TUI (Re: [RFC 8.3 0/3] Some style fixes)

Hannes Domani via gdb-patches
2019-03-15T12:34:53Z

Am Donnerstag, 14. März 2019, 21:58:40 MEZ hat Pedro Alves <palves@redhat.com> Folgendes geschrieben:

> I agree.  Hannes, I've written a git commit log entry, as well
> as a ChangeLog entry for you.  Please double-check whether
> I didn't make some mistake.
>
> I've made one change in the patch, here:
>
> On 03/12/2019 05:08 PM, Hannes Domani via gdb-patches wrote:
> > +      if (column <= first_col || column > first_col + line_width)
> > +    {
> > +      if (c == '\t')
> > +        {
> > +          int j, max_tab_len = tui_tab_width;
> > +
> > +          --column;
> > +          for (j = column % max_tab_len;
> > +          j < max_tab_len && column < first_col + line_width;
> > +          column++, j++)
> > +        if (column >= first_col)
> > +          result.push_back (' ');
> > +        }
> > +      continue;
> > +    }
>
> instead of duplicating that code, I'd put it in a lambda
> and use it in both places.

Since that duplicate code actually did bother me, I prefer your changes.
And I just tested it, still works fine.

Regards
Hannes Domani