Re: [rfc] More intelligent indenting of multi-line table entries (Re: [RFA] Implement support for PowerPC BookE ranged breakpoints)

Pedro Alves
2011-02-25T14:44:35Z

On Thursday 24 February 2011 20:41:12, Ulrich Weigand wrote:

> Now the thing is, the UI table layer already knows exactly where
> that column starts, so it is kind of pointless to attempt to
> re-compute that offset. In particular, since the code currently
> gets it completely wrong anyway: at some point, another column of
> variable size was added --see print_type_col_width in breakpoint_1--
> but the wrap_indent logic was never updated.

Whoops. Guilty, but it goes further back than that. It looks
like it got broken when we made the "Num" column wider:

7.0:

Num Type Disp Enb Address What
1 breakpoint keep y 0x080912fb in internal_error
at ../../src/gdb/utils.c:1048

6.0:

Num Type Disp Enb Address What
1 breakpoint keep y 0x08122147 in internal_error
at ../../gdb-6.0/gdb/utils.c:807

Shows how fragile that code was. Makes me wonder about making
that column's width dynamic as well.

> My thought was to remove that redundancy completely, and simply
> ask the UI table layer for the correct position. It turns out
> that this needs some new functionality exported from that layer,
> but a simply query for the field information you originally
> passed to that layer suffices.
>
> The following patch implements this suggestion; it fixes the currently
> broken indentation and gets rid of the silly arguments to the
> print_breakpoint_location function.
>
> Tested on i386-linux and by manual inspection of line wrapping.
>
> Any comments?

Looks great to me.

I've mentioned this before, but I think it'd really be nice
that the table layout support was reworked to be able to auto
wrap (and size perhaps) columns nicely, à la emacs' org-mode,
vis:

| Num | Name | What | Other column |
|-----+--------------+----------+--------------|
| 1 | foo bar | foo | another |
| | | bar what | broken |
| | | | sentence |
|-----+--------------+----------+--------------|
| 2 | the other | what? | yummy |

so that all colums would line-break nicely without
messing their rightmost columns. (without the guide
lines, of course).

--
Pedro Alves