|
3 | 3 | local util = require('tests.util')
|
4 | 4 |
|
5 | 5 | ---@param row integer
|
6 |
| ----@param text string |
| 6 | +---@param sections integer[][] |
7 | 7 | ---@return render.md.MarkInfo
|
8 |
| -local function delimiter(row, text) |
| 8 | +local function delimiter(row, sections) |
| 9 | + local text = vim.iter(sections) |
| 10 | + :map(function(widths) |
| 11 | + return vim.iter(widths) |
| 12 | + :map(function(width) |
| 13 | + return width == 1 and '━' or string.rep('─', width) |
| 14 | + end) |
| 15 | + :join('') |
| 16 | + end) |
| 17 | + :join('┼') |
| 18 | + |
9 | 19 | ---@type render.md.MarkInfo
|
10 | 20 | return {
|
11 | 21 | row = { row, row },
|
12 |
| - col = { 0, vim.fn.strdisplaywidth(text) }, |
13 |
| - virt_text = { { text, util.hl('TableHead') } }, |
| 22 | + col = { 0, vim.fn.strdisplaywidth(text) + 2 }, |
| 23 | + virt_text = { { '├' .. text .. '┤', util.hl('TableHead') } }, |
14 | 24 | virt_text_pos = 'overlay',
|
15 | 25 | }
|
16 | 26 | end
|
@@ -52,12 +62,7 @@ describe('list_table.md', function()
|
52 | 62 | util.table_pipe(row:get(), 33, true),
|
53 | 63 | util.table_pipe(row:get(), 40, true),
|
54 | 64 | })
|
55 |
| - vim.list_extend(expected, { |
56 |
| - delimiter( |
57 |
| - row:increment(), |
58 |
| - '├━───────┼───────━───────┼──────━┼──────┤' |
59 |
| - ), |
60 |
| - }) |
| 65 | + table.insert(expected, delimiter(row:increment(), { { 1, 7 }, { 7, 1, 7 }, { 6, 1 }, { 6 } })) |
61 | 66 | vim.list_extend(expected, {
|
62 | 67 | util.table_pipe(row:increment(), 0, false),
|
63 | 68 | util.inline_code(row:get(), 2, 8),
|
|
0 commit comments