vim. update s:get_columns()
This commit is contained in:
parent
e4060eb421
commit
019a60e6d1
1 changed files with 16 additions and 8 deletions
|
|
@ -107,7 +107,7 @@ function! LedgerFoldText() "{{{1
|
||||||
\ '\(^\s\+\|\s\+$\)', '', 'g')
|
\ '\(^\s\+\|\s\+$\)', '', 'g')
|
||||||
|
|
||||||
" number of columns foldtext can use
|
" number of columns foldtext can use
|
||||||
let columns = s:get_columns(0)
|
let columns = s:get_columns()
|
||||||
if g:ledger_maxwidth
|
if g:ledger_maxwidth
|
||||||
let columns = min([columns, g:ledger_maxwidth])
|
let columns = min([columns, g:ledger_maxwidth])
|
||||||
endif
|
endif
|
||||||
|
|
@ -122,9 +122,9 @@ function! LedgerFoldText() "{{{1
|
||||||
let foldtext .= repeat(' ', filen - (folen%filen))
|
let foldtext .= repeat(' ', filen - (folen%filen))
|
||||||
|
|
||||||
let foldtext .= repeat(g:ledger_fillstring,
|
let foldtext .= repeat(g:ledger_fillstring,
|
||||||
\ s:get_columns(0)/filen)
|
\ s:get_columns()/filen)
|
||||||
else
|
else
|
||||||
let foldtext .= repeat(' ', s:get_columns(0))
|
let foldtext .= repeat(' ', s:get_columns())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" we don't use slices[:5], because that messes up multibyte characters
|
" we don't use slices[:5], because that messes up multibyte characters
|
||||||
|
|
@ -511,19 +511,27 @@ function! s:multibyte_strlen(text) "{{{2
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" get # of visible/usable columns in current window
|
" get # of visible/usable columns in current window
|
||||||
function! s:get_columns(win) "{{{2
|
function! s:get_columns() " {{{2
|
||||||
" As long as vim doesn't provide a command natively,
|
" As long as vim doesn't provide a command natively,
|
||||||
" we have to compute the available columns.
|
" we have to compute the available columns.
|
||||||
" see :help todo.txt -> /Add argument to winwidth()/
|
" see :help todo.txt -> /Add argument to winwidth()/
|
||||||
" FIXME: Although this will propably never be used with debug mode enabled
|
|
||||||
" this should take the signs column into account (:help sign.txt)
|
let columns = (winwidth(0) == 0 ? 80 : winwidth(0)) - &foldcolumn
|
||||||
let columns = (winwidth(a:win) == 0 ? 80 : winwidth(a:win)) - &foldcolumn
|
|
||||||
if &number
|
if &number
|
||||||
" line('w$') is the line number of the last line
|
" line('w$') is the line number of the last line
|
||||||
let columns -= max([len(line('w$'))+1, &numberwidth])
|
let columns -= max([len(line('w$'))+1, &numberwidth])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" are there any signs/is the sign column displayed?
|
||||||
|
redir => signs
|
||||||
|
silent execute 'sign place buffer='.string(bufnr("%"))
|
||||||
|
redir END
|
||||||
|
if signs =~# 'id='
|
||||||
|
let columns -= 2
|
||||||
|
endif
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
endfunction "}}}
|
endf "}}}
|
||||||
|
|
||||||
" remove spaces at start and end of string
|
" remove spaces at start and end of string
|
||||||
function! s:strip_spaces(text) "{{{2
|
function! s:strip_spaces(text) "{{{2
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue