diff --git a/plugin/table-mode.vim b/plugin/table-mode.vim index 25b30f3..f266f4a 100644 --- a/plugin/table-mode.vim +++ b/plugin/table-mode.vim @@ -100,8 +100,8 @@ onoremap (table-mode-cell-text-object-i) :call tablemode#spr xnoremap (table-mode-cell-text-object-a) :call tablemode#spreadsheet#cell#TextObject(0) xnoremap (table-mode-cell-text-object-i) :call tablemode#spreadsheet#cell#TextObject(1) -nnoremap (table-mode-delete-row) :call tablemode#spreadsheet#DeleteRow() -nnoremap (table-mode-delete-column) :call tablemode#spreadsheet#DeleteColumn() +nnoremap (table-mode-delete-row) :call tablemode#spreadsheet#DeleteRow() +nnoremap (table-mode-delete-column) :call tablemode#spreadsheet#DeleteColumn() nnoremap (table-mode-add-formula) :call tablemode#spreadsheet#formula#Add() nnoremap (table-mode-eval-formula) :call tablemode#spreadsheet#formula#EvaluateFormulaLine() diff --git a/t/fixtures/big_sample.txt b/t/fixtures/big_sample.txt new file mode 100644 index 0000000..5e9cf5b --- /dev/null +++ b/t/fixtures/big_sample.txt @@ -0,0 +1,7 @@ +|---+---+---+---| +| 1 | 9 | a | z | +| 2 | 8 | b | y | +| 3 | 7 | c | x | +| 4 | 6 | d | w | +| 5 | 5 | e | v | +|---+---+---+---| diff --git a/t/spreadsheet.vim b/t/spreadsheet.vim index 093475c..f83194f 100644 --- a/t/spreadsheet.vim +++ b/t/spreadsheet.vim @@ -102,4 +102,25 @@ describe 'spreadsheet' Expect tablemode#spreadsheet#ColumnCount('.') == 1 end end + + describe 'Repeated Manipulations' + before + new + normal! ggdG + read t/fixtures/big_sample.txt + call cursor(2, 3) + end + + it 'should delete multiple rows correctly' + Expect tablemode#spreadsheet#RowCount('.') == 5 + .,.+1 call tablemode#spreadsheet#DeleteRow() + Expect tablemode#spreadsheet#RowCount('.') == 3 + end + + it 'should delete multiple columns correctly' + Expect tablemode#spreadsheet#ColumnCount('.') == 4 + .,.+1 call tablemode#spreadsheet#DeleteColumn() + Expect tablemode#spreadsheet#ColumnCount('.') == 2 + end + end end