cute-jumper / org-table-sticky-header

Sticky header for org-mode tables
36 stars 4 forks source link

Narrowed head line #2

Closed theldoria closed 7 years ago

theldoria commented 7 years ago

Narrowed columns are respected. However, if the head-line is narrowed the layout is wrong.

    * Table

    | Byte | Bit | Bit-Offset | Type  | Description |
    |      |     |  <4>       |       |             |
    |------+-----+------------+-------+-------------|
    |    0 |   0 |          0 | DWORD |             |
    |    6 |   0 |         48 | DWORD |             |
    |   10 |   0 |         80 | BYTE  |             |
    |   11 |   0 |         88 | BOOL  |             |
    |   11 |   1 |         89 | BOOL  |             |
    |   11 |   2 |         90 | BOOL  |             |
    |   11 |   3 |         91 | BOOL  |             |
    |   14 |   0 |         96 | DWORD |             |
    |   16 |   0 |        128 | BYTE  |             |
    |   17 |   0 |        136 | BOOL  |             |
    |   17 |   1 |        137 | BOOL  |             |
    |   17 |   2 |        138 | BOOL  |             |
    |   17 |   3 |        139 | BOOL  |             |
cute-jumper commented 7 years ago

Sorry, but I don't get it. What do you mean by "if the head-line is narrowed the layout is wrong"?

theldoria commented 7 years ago

The colum with heading Bit-Offset is set to size 4 by <4>. That leads to an abbreviation of the heading in org-mode buffer, thus that the heading reads Bi=>. However, this abbreviation is not reflected in the sticky head line.

The table, seen in org-mode, looks like this:

| Byte | Bit | Bi=> | Type  | Description |
|      |     |  <4> |       |             |
|------+-----+------+-------+-------------|
|    0 |   0 |    0 | DWORD |             |
|    6 |   0 |   48 | DWORD |             |
|   10 |   0 |   80 | BYTE  |             |
|   11 |   0 |   88 | BOOL  |             |
|   11 |   1 |   89 | BOOL  |             |

Btw, if you put narrowing above the head line, then they are shown as sticky head line instead. But this may be worth a second issue...

cute-jumper commented 7 years ago

Thanks for the explanation. For the narrowing, two commits were pushed and I hope it should be fixed now. Let me know if that doesn't work.

For the question of which line should be considered to be the real header, I found it hard to cover various situations so I simply take the first line of the table and use that as the header line. Do you have any suggestions regarding this?

theldoria commented 7 years ago

Ok, I will try it this afternoon.

Regarding the line to be considered: I am not yet sure whether this is an issue that must be addressed. It is possible to have the narrowing information as second line, though I don't know if that is intended in org-mode. If it is, then you could simply give the advice to asure the header row as the first and keep table configuation rows below the header.

theldoria commented 7 years ago

Works like a charm :+1:.