@@ -307,18 +307,16 @@ end
307307--- Compute display segments for a cell: raw text − concealed + injected,
308308--- with treesitter highlight groups preserved.
309309--- @private
310- --- @param row integer
311- --- @param start_col integer
312- --- @param end_col integer
310+ --- @param node render.md.Node
313311--- @return render.md.mark.Line
314- function Render :cell_segments (row , start_col , end_col )
315- local raw_full = vim . api . nvim_buf_get_text (
316- self . context . buf , row , start_col , row , end_col , {}
317- )[ 1 ] or ' '
318- -- Trim cell padding upfront so we don't need post-processing
319- local lead = # (raw_full :match (' ^(%s*)' ) or ' ' )
320- local trail = # (raw_full :match (' (%s*)$' ) or ' ' )
321- local raw = raw_full :sub (lead + 1 , # raw_full - trail )
312+ function Render :cell_segments (node )
313+ local row = node . start_row
314+ local start_col = node . start_col
315+ local end_col = node . end_col
316+
317+ local lead = # (node . text :match (' ^(%s*)' ) or ' ' )
318+ local trail = # (node . text :match (' (%s*)$' ) or ' ' )
319+ local raw = node . text :sub (lead + 1 , # node . text - trail )
322320 local base_col = start_col + lead
323321 local injections = self .context .offset :range (row , start_col , end_col )
324322
@@ -562,7 +560,7 @@ function Render:row_wrapped(row, row_index)
562560 -- Pre-compute display segments for each cell in this row
563561 local cell_segs = {} --- @type render.md.mark.Line[]
564562 for i , col in ipairs (row .cells ) do
565- cell_segs [i ] = self :cell_segments (col .node . start_row , col . node . start_col , col . node . end_col )
563+ cell_segs [i ] = self :cell_segments (col .node )
566564 end
567565
568566 local filler = self .config .filler
0 commit comments