From cd25233cc826000192b92f94e84b0522afce730b Mon Sep 17 00:00:00 2001 From: Alexey Radkov Date: Sun, 4 May 2014 17:09:42 +0400 Subject: [PATCH] fast and in Insert mode this also fixes Tab navigation in a new added line --- autoload/vimwiki/tbl.vim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/tbl.vim b/autoload/vimwiki/tbl.vim index aa13202..368dcd5 100644 --- a/autoload/vimwiki/tbl.vim +++ b/autoload/vimwiki/tbl.vim @@ -408,7 +408,13 @@ function! vimwiki#tbl#goto_next_col() "{{{ let curcol = virtcol('.') let lnum = line('.') let newcol = s:get_indent(lnum) - let max_lens = s:get_cell_max_lens(lnum) + let rows = s:get_rows(lnum, 2) + let startlnum = rows[0][0] + let cells = [] + for [lnum, row] in rows + call add(cells, vimwiki#tbl#get_cells(row, 1)) + endfor + let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows) for cell_len in values(max_lens) if newcol >= curcol-1 break @@ -434,7 +440,13 @@ function! vimwiki#tbl#goto_prev_col() "{{{ let curcol = virtcol('.') let lnum = line('.') let newcol = s:get_indent(lnum) - let max_lens = s:get_cell_max_lens(lnum) + let rows = s:get_rows(lnum, 2) + let startlnum = rows[0][0] + let cells = [] + for [lnum, row] in rows + call add(cells, vimwiki#tbl#get_cells(row, 1)) + endfor + let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows) let prev_cell_len = 0 echom string(max_lens) for cell_len in values(max_lens)