mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Fix #56
* Fixed tablemode#spreadsheet#cell#SetCell() to accommodate the fact that we can have borders anywhere in the table. Using tablemode#spreadsheet#LineNr() to get get the line of the actual row in the table. * Fixed tablemode#spreadsheet#LineNr()
This commit is contained in:
@@ -56,15 +56,15 @@ function! tablemode#spreadsheet#MoveToLastRow() "{{{2
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! tablemode#spreadsheet#LineNr(row) "{{{2
|
function! tablemode#spreadsheet#LineNr(line, row) "{{{2
|
||||||
if tablemode#table#IsRow('.')
|
if tablemode#table#IsRow(a:line)
|
||||||
let line = tablemode#spreadsheet#GetFirstRow('.')
|
let line = tablemode#spreadsheet#GetFirstRow(a:line)
|
||||||
let row_nr = 0
|
let row_nr = 0
|
||||||
|
|
||||||
while tablemode#table#IsRow(line + 1) || tablemode#table#IsBorder(line + 1)
|
while tablemode#table#IsRow(line + 1) || tablemode#table#IsBorder(line + 1)
|
||||||
if tablemode#table#IsRow(line)
|
if tablemode#table#IsRow(line)
|
||||||
let row_nr += 1
|
let row_nr += 1
|
||||||
if row ==# row_nr | break | endif
|
if a:row ==# row_nr | break | endif
|
||||||
endif
|
endif
|
||||||
let line += 1
|
let line += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ function! tablemode#spreadsheet#cell#SetCell(val, ...) "{{{2
|
|||||||
if colm < 0 | let colm = tablemode#spreadsheet#ColumnCount(line) + colm + 1 | endif
|
if colm < 0 | let colm = tablemode#spreadsheet#ColumnCount(line) + colm + 1 | endif
|
||||||
|
|
||||||
if tablemode#table#IsRow(line)
|
if tablemode#table#IsRow(line)
|
||||||
let line = tablemode#utils#line(line) + (row - tablemode#spreadsheet#RowNr(line)) * 1
|
let line = tablemode#spreadsheet#LineNr(line, row)
|
||||||
let line_val = getline(line)
|
let line_val = getline(line)
|
||||||
let cstartexpr = tablemode#table#StartCommentExpr()
|
let cstartexpr = tablemode#table#StartCommentExpr()
|
||||||
let values = split(getline(line)[stridx(line_val, g:table_mode_separator):strridx(line_val, g:table_mode_separator)], g:table_mode_separator)
|
let values = split(getline(line)[stridx(line_val, g:table_mode_separator):strridx(line_val, g:table_mode_separator)], g:table_mode_separator)
|
||||||
|
|||||||
Reference in New Issue
Block a user