@@ -323,23 +323,16 @@ end
323323--- Compute display segments for a cell: raw text − concealed + injected,
324324--- with treesitter highlight groups preserved.
325325--- @private
326- --- @param row integer
327- --- @param start_col integer
328- --- @param end_col integer
326+ --- @param node render.md.Node
329327--- @return render.md.mark.Line
330- function Render :cell_segments (row , start_col , end_col )
331- local raw_full = vim .api .nvim_buf_get_text (
332- self .context .buf ,
333- row ,
334- start_col ,
335- row ,
336- end_col ,
337- {}
338- )[1 ] or ' '
339- -- Trim cell padding upfront so we don't need post-processing
340- local lead = # (raw_full :match (' ^(%s*)' ) or ' ' )
341- local trail = # (raw_full :match (' (%s*)$' ) or ' ' )
342- local raw = raw_full :sub (lead + 1 , # raw_full - trail )
328+ function Render :cell_segments (node )
329+ local row = node .start_row
330+ local start_col = node .start_col
331+ local end_col = node .end_col
332+
333+ local lead = # (node .text :match (' ^(%s*)' ) or ' ' )
334+ local trail = # (node .text :match (' (%s*)$' ) or ' ' )
335+ local raw = node .text :sub (lead + 1 , # node .text - trail )
343336 local base_col = start_col + lead
344337 local injections = self .context .inline :range (row , start_col , end_col )
345338
@@ -601,8 +594,7 @@ function Render:row_wrapped(row, row_index)
601594 -- Pre-compute display segments for each cell in this row
602595 local cell_segs = {} --- @type render.md.mark.Line[]
603596 for i , cell in ipairs (row .cells ) do
604- cell_segs [i ] =
605- self :cell_segments (row .node .start_row , cell .start_col , cell .end_col )
597+ cell_segs [i ] = self :cell_segments (cell .node )
606598 end
607599
608600 local filler = self .config .filler
0 commit comments