Skip to content

feat(table): add cell wrapping using virt lines - #665

Open
okuuva wants to merge 16 commits into
MeanderingProgrammer:mainfrom
okuuva:push-pqyvpkqtvlpx
Open

feat(table): add cell wrapping using virt lines#665
okuuva wants to merge 16 commits into
MeanderingProgrammer:mainfrom
okuuva:push-pqyvpkqtvlpx

Conversation

@okuuva

@okuuva okuuva commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Continued work on top of #617:

  • Rebased on top of the latest main
  • Fixed the bottom border rendering when the table was at the end of the file
  • Fixed the long header separator rendering
  • Fixed the indented wrapped table rendering
  • Made wrapping use word boundaries instead of just always wrapping at the character limit
  • Fixed the wrapping when continuation markers are in use
  • Implemented cell alignment for wrapped cells

@okuuva
okuuva force-pushed the push-pqyvpkqtvlpx branch from 3553ea5 to 5e0e85d Compare June 5, 2026 22:23
@okuuva
okuuva marked this pull request as ready for review June 6, 2026 07:31
@okuuva
okuuva force-pushed the push-pqyvpkqtvlpx branch from acde363 to 969b742 Compare June 6, 2026 16:05
---@field cell_offset fun(ctx: render.md.table.cell.Context): integer
---@field padding integer
---@field min_width integer
---@field max_table_width number

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentinelt added a commit to sentinelt/render-markdown.nvim that referenced this pull request Aug 3, 2026
Apply changes from MeanderingProgrammer#665
(continued work on table wrapping with virt lines, word-boundary wrap,
alignment, indented tables, EOF bottom border fixes).
@andrewroxby

andrewroxby commented Aug 7, 2026

Copy link
Copy Markdown

Been running this branch daily with wrap on — thank you, it makes wide tables genuinely usable. With indent.enabled = true I hit three interactions between the cell wrapping and the indent module, plus a wrap-boundary bug in the slot simulation. All four are fixed on table-wrap-fixes (b9ee242 + c53110f).

  1. Overlay-placed visual rows don't include the indent prefix that the virt_lines path adds, so part of an indented table shifts sideways by the indent width.
  2. The width budget in compute_wrap_layout doesn't subtract the indent's virtual columns, so under nested headings the right border lands past the window edge.
  3. wrapped_slots simulates raw-text wrapping without the indent's inline columns. A row whose raw width straddles the boundary gets a stale slot map — a blank screen line mid-table, with later rows displaced into virt_lines. (The concealed source line still wraps on its raw width; conceal blanks glyphs but doesn't reflow.)
  4. wrapped_slots also breaks out of its scan when a screen row fills to exact capacity, but Neovim leaves a following break character hanging at the boundary, so the simulation rewinds the wrap one word early and every later overlay lands one screen row off. Symptoms are width- and content-dependent, which made this one erratic to reproduce.

Happy to open a PR into this branch if useful.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants