Fix #156, improved cursor column detection

This commit is contained in:
Dhruva Sagar
2019-12-10 16:13:16 -05:00
parent 8677840826
commit 5ac34a22db

View File

@@ -181,6 +181,11 @@ function! tablemode#spreadsheet#Average(range, ...) abort "{{{2
endfunction
function! tablemode#spreadsheet#Sort(bang, ...) range "{{{2
if exists('*getcurpos')
let col = getcurpos()[4] " curswant
else
let col = col('.')
endif
let opts = a:0 ? a:1 : ''
let bang = a:bang ? '!' : ''
if a:firstline == a:lastline
@@ -189,5 +194,5 @@ function! tablemode#spreadsheet#Sort(bang, ...) range "{{{2
let [firstRow, lastRow] = [a:firstline, a:lastline]
endif
call tablemode#spreadsheet#MoveToStartOfCell()
exec ':undojoin | '.firstRow.','.lastRow . 'sort'.bang opts '/.*\%'.col('.').'v/'
exec ':undojoin | '.firstRow.','.lastRow . 'sort'.bang opts '/.*\%'.col.'v/'
endfunction