Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Ability to resize column widths of tables in text preview

Open aq7zo opened this issue 1 month ago • 2 comments

What problem would this solve?

When one table column contains a long string of text, it takes width from the other columns. The other affected columns then get squeezed until their text wraps onto a second line, which makes the table harder to read in the preview as more text is introduced.

Image

What would you like?

Let me drag a column's border in the preview to change that column's width, as in spreadsheets and most table editors. Widths could reset when the file is reloaded, or be saved per table if that's practical. A double-click on the border could auto-fit the column to its content.

Alternatives could be:

  • Horizontal scrolling for wide tables, so columns keep a reasonable minimum width instead of being squashed.
  • A min-width or max-width setting for table cells.

Has another app got this right?

Google Sheet or Excel table column resizing

Which platform is this for?

All platforms

Your Markpad version and how you installed it

No response

aq7zo avatar Oct 27 '26 08:10 aq7zo

Thanks for the screenshot. Drag-to-resize columns looks doable and small, so it may land in an upcoming release. Widths would reset when the file is reopened, and a double-click on the border would return the column to automatic width. Saving widths per table is out of scope for now, since GFM tables have nowhere to store them.

Technical notes
  • Tables are currently display: block; width: max-content; max-width: 100%. A table that fits gets its columns squeezed by auto layout, and only a wider one scrolls. That is why a long cell takes width from its neighbours.
  • Plan: pointer handling on the preview host. A press within a few pixels of a header cell's right edge starts a drag. The first drag freezes every column's current width and switches that table to table-layout: fixed, so resizing one column does not reflow the others. A double-click clears the widths. No handle elements are inserted, so the rendered HTML, copy and export stay unchanged.
  • The preview is patched per block, so a resized table keeps its widths while other parts of the document are edited. Editing that table's own source replaces it and resets the widths.
  • To check: whether PDF export / print picks up the widths, RTL drag direction, and touch drag vs horizontal scroll.
  • Rough size: ~100–150 lines of code plus a Playwright spec.

PathGao avatar Oct 27 '26 16:10 PathGao

This is in 2.9.0: https://github.com/sftwrdotdev/Markpad/releases/tag/v2.9.0. Drag a column border in the preview to resize table columns, and double-click the border to return to automatic width. Widths reset when the file is reopened.

PathGao avatar Oct 29 '26 03:10 PathGao