Fixed tablemode#TableMotion

This commit is contained in:
Dhruva Sagar
2014-03-18 18:21:35 +05:30
parent 8e37d67505
commit 0b03a88ffb

View File

@@ -789,14 +789,16 @@ function! tablemode#ColumnNr(pos) "{{{2
return s:Strlen(substitute(getline(pos[0])[(row_start):pos[1]-2], '[^' . g:table_mode_separator . ']', '', 'g'))
endfunction
function! tablemode#TableMotion(direction) "{{{2
function! tablemode#TableMotion(direction, ...) "{{{2
let l:count = a:0 ? a:1 : v:count1
if tablemode#IsATableRow('.')
for ii in range(l:count)
if a:direction ==# 'l'
if s:IsLastCell()
if !tablemode#IsATableRow(line('.') + s:RowGap()) || (tablemode#IsATableHeader(line('.') + s:RowGap()) && tablemode#IsATableRow(line('.') + 2 * s:RowGap()))
if !tablemode#IsATableRow(line('.') + s:RowGap()) || (tablemode#IsATableHeader(line('.') + s:RowGap()) && !tablemode#IsATableRow(line('.') + 2 * s:RowGap()))
return
endif
call tablemode#TableMotion('j')
call tablemode#TableMotion('j', 1)
normal! 0
endif
@@ -808,10 +810,10 @@ function! tablemode#TableMotion(direction) "{{{2
endif
elseif a:direction ==# 'h'
if s:IsFirstCell()
if !tablemode#IsATableRow(line('.') - s:RowGap()) || (tablemode#IsATableHeader(line('.') - s:RowGap()) && tablemode#IsATableRow(line('.') - 2 * s:RowGap()))
if !tablemode#IsATableRow(line('.') - s:RowGap()) || (tablemode#IsATableHeader(line('.') - s:RowGap()) && !tablemode#IsATableRow(line('.') - 2 * s:RowGap()))
return
endif
call tablemode#TableMotion('k')
call tablemode#TableMotion('k', 1)
normal! $
endif
@@ -834,6 +836,7 @@ function! tablemode#TableMotion(direction) "{{{2
execute 'normal! ' . (s:RowGap() + 1) . 'k'
endif
endif
endfor
endif
endfunction