Skip to content

Table alignment broken for certain tables since display-width rewrite #256

Description

@snoopier

Describe the bug

Since the rewrite of eca-table-align in commit 403dc46 (V16.09), some markdown tables are not aligned correctly in the chat buffer. The previous approach (markdown-table-align + overlay compensation via eca-table--compensate-hidden-markup) worked reliably.

Observed behavior

Certain tables appear misaligned after rendering in the chat buffer — columns don't line up. The issue is intermittent and seems to depend on table content (cell count, markup presence, cell width variance).

Expected behavior

All tables should be visually aligned, as they were before the rewrite (prior to 403dc46).

Investigation so far

  • eca-table--display-width returns correct values in isolation (e.g. "**bold**" → 4, "plain" → 5), so the font-lock measurement buffer appears to work for individual calls.
  • The suspicion is in the table parser/rebuilder pipeline (eca-table--parse-row, eca-table--align-at-point), not in eca-table--display-width itself. Possible causes:
    • Row parsing edge cases (e.g. separator detection, trailing pipes, special characters)
    • Separator cell width calculation (eca-table--make-separator-cell) producing off-by-one padding
    • Accumulated rounding in per-cell padding when display-width differs from string-width across many columns
  • Reverting to the previous commit (cd24036) which uses markdown-table-align + eca-table--compensate-hidden-markup fixes the alignment.

Reproduction

Send a markdown table with uneven column widths to an ECA chat buffer. Example:

| Name | Alter | Stadt | Beruf | Hobby |
|---|---|---|---|---|
| Anna | 29 | Berlin | Softwareentwicklerin | Klettern |
| Bo | 4 | Aachen | Student | Lesen |
| Christoph Maximilian | 55 | B | Architekt und Stadtplaner | Aquarellmalerei und Fotografie |
| D | 100 | Frankfurt am Main | x | y |

Environment

  • ECA Emacs package: current HEAD (8f60746)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions