Fix the column modifications on escaped separators

If a g:table_mode_separator is escaped by a backslash, the table is
aligned ignoring this instance of the g:table_mode_separator, but the
column deletion and insertion functions did not consider this behaviour.

The g:table_mode_escaped_separator regex is simplified and optimized a
little bit. Also more care is taken to prevent unexpected behaviour if
special characters are used as g:table_mode_separator.
This commit is contained in:
ibbem
2020-04-03 23:41:56 +02:00
parent 67129cd1e0
commit 85a5e3d4e1
6 changed files with 60 additions and 12 deletions

View File

@@ -60,3 +60,7 @@ function tablemode#utils#MoveToLine(line) "{{{2
execute "normal! ".(-offset)."k"
endif
endfunction
function! tablemode#utils#SeparatorCount(str)
return tablemode#utils#strlen(substitute(a:str, '\V\C\(\\' . escape(g:table_mode_separator, '\') . '\|\[^' . escape(g:table_mode_separator, ']^-\') . ']\)', '', 'g'))
endfunction