commit 4d1bb91dbe2d6ba8bc7d6619b4f66a239c642329
parent cd25233cc826000192b92f94e84b0522afce730b
Author: Alexey Radkov <alexey.radkov@gmail.com>
Date: Sun, 4 May 2014 18:42:00 +0400
small fix in s:get_aligned_rows()
Diffstat:
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/autoload/vimwiki/tbl.vim b/autoload/vimwiki/tbl.vim
@@ -263,6 +263,7 @@ function! s:get_aligned_rows(lnum, col1, col2) "{{{
let cells = []
let max_lens = {}
let lrows = len(rows)
+ let check_all = 1
if lrows == depth + 1
let i = 1
for [lnum, row] in rows
@@ -271,16 +272,17 @@ function! s:get_aligned_rows(lnum, col1, col2) "{{{
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
let fst_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows[0:0])
- if max_lens != fst_lens
- " all the table must be re-formatted
- let rows = s:get_rows(a:lnum)
- let startlnum = rows[0][0]
- let cells = []
- for [lnum, row] in rows
- call add(cells, vimwiki#tbl#get_cells(row))
- endfor
- let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
- endif
+ let check_all = max_lens != fst_lens
+ endif
+ if check_all
+ " all the table must be re-formatted
+ let rows = s:get_rows(a:lnum)
+ let startlnum = rows[0][0]
+ let cells = []
+ for [lnum, row] in rows
+ call add(cells, vimwiki#tbl#get_cells(row))
+ endfor
+ let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
endif
let result = []
for [lnum, row] in rows