fix(tables): don't skip escaped \| in cell scan — match the server
CI / editor tests (push) Successful in 46s

The server lexer (nuwiki-rs) splits table cells on a backslash-escaped `\|`
(it can't skip it yet without leaving a stray backslash in the output), but
the client's cell_bar_positions was skipping `\|`. That made the editor
auto-align keep `a\|b` as one cell while HTML export split it into two.

Drop the `\|` case from both clients so buffer alignment and export agree.
`[[…]]` / `{{…}}` / `` `code` `` pipes are still treated as literal. A
coordinated `\|` follow-up (server unescaping + client re-adding the skip)
is tracked in nuwiki-rs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:43:02 +00:00
parent 51e857f3c6
commit 5375e30bda
2 changed files with 14 additions and 12 deletions
+7 -6
View File
@@ -1161,9 +1161,12 @@ endfunction
" 0-based byte offsets of the cell-separator `|` in `s`. Pipes that are literal
" cell content are skipped: those inside `[[…]]` wikilinks, `{{…}}`
" transclusions, `` `…` `` inline code, and backslash-escaped `\|`. Byte-based
" (strpart/stridx) to match the rest of the table code. Keeps a `[[url|title]]`
" link in one cell instead of splitting on its internal pipe.
" transclusions, and `` `…` `` inline code. Byte-based (strpart/stridx) to match
" the rest of the table code. Keeps a `[[url|title]]` link in one cell instead
" of splitting on its internal pipe.
"
" Backslash-escaped `\|` is intentionally NOT skipped, to match the server
" lexer (nuwiki-rs). See the nuwiki-rs issue for the coordinated `\|` follow-up.
function! s:cell_bar_positions(s) abort
let l:out = []
let l:i = 0
@@ -1171,9 +1174,7 @@ function! s:cell_bar_positions(s) abort
while l:i < l:n
let l:c = strpart(a:s, l:i, 1)
let l:two = strpart(a:s, l:i, 2)
if l:c ==# '\'
let l:i += 2
elseif l:c ==# '`'
if l:c ==# '`'
let l:close = stridx(a:s, '`', l:i + 1)
let l:i = l:close < 0 ? l:n : l:close + 1
elseif l:two ==# '[['