fix(tables): don't split a cell on a | inside a link/code/escape
CI / editor tests (push) Successful in 46s
CI / editor tests (push) Successful in 46s
Table auto-alignment scanned for cell separators with a naive find('|'),
so a cell containing a vimwiki link `[[url|title]]` was split at the link's
internal pipe — mangling both the link (`[[url` / `title]]`) and the table
(a phantom extra column). Same bug in both the Lua (Neovim) and VimL (Vim)
table code, in both table_cell_starts and parse_table_row.
Add a shared cell-separator scanner (cell_bar_positions) that treats `|` as
literal — not a separator — when it's inside `[[…]]` wikilinks, `{{…}}`
transclusions, `` `…` `` inline code, or backslash-escaped (`\|`), matching
vimwiki. Both scan functions in each client now use it.
Regression tests added on both clients (cr.table_link_cell_pipe_not_a_separator);
full harness green (Neovim 308, Vim 302).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -336,6 +336,14 @@ call s:run('cr.adds_new_table_row', {
|
||||
\ 'keys': "A\<CR>x\<Esc>",
|
||||
\ 'expect_lines': ['| a | b |', '|x | |'],
|
||||
\ })
|
||||
" Regression: a `|` inside `[[u|t]]` must not split the cell — the link stays
|
||||
" intact and the row keeps 2 columns (fresh row has 2 cells, not 3).
|
||||
call s:run('cr.table_link_cell_pipe_not_a_separator', {
|
||||
\ 'lines': ['| a | [[u|t]] |'],
|
||||
\ 'cursor': [1, 4],
|
||||
\ 'keys': "A\<CR>x\<Esc>",
|
||||
\ 'expect_lines': ['| a | [[u|t]] |', '|x | |'],
|
||||
\ })
|
||||
" Insert <S-CR>: multiline list item — continue with NO marker, aligned under
|
||||
" the text ("- " → 2 cols; "- [ ] " → 6 cols).
|
||||
call s:run('cr.shift_cr_multiline', {
|
||||
|
||||
Reference in New Issue
Block a user