Remove manual width calculation and handle horizontal scroll

This commit is contained in:
Jacob Niehus
2014-10-20 15:50:44 -07:00
parent 048b9dc286
commit e1a49790cb
2 changed files with 7 additions and 6 deletions

View File

@@ -168,9 +168,9 @@ endfunction
" Determine where the current window is on the screen for displaying call
" signatures in the correct column.
function! s:save_first_col()
let gutterwidth = &fdc + &number * max([&numberwidth, len(line('$')) + 1])
if bufname('%') ==# '[Command Line]' | return gutterwidth + 1 | endif
if winnr('$') == 1 | return gutterwidth | endif
if bufname('%') ==# '[Command Line]' || winnr('$') == 1
return 0
endif
let l:eventignore = &eventignore
set eventignore=all
@@ -182,7 +182,7 @@ function! s:save_first_col()
wincmd h
let win_on_left = winnr() == startwin
if win_on_left
return gutterwidth
return 0
else
" Walk left and count up window widths until hitting the edge
execute startwin."wincmd w"
@@ -194,7 +194,7 @@ function! s:save_first_col()
let winnr = winnr()
wincmd h
endwhile
return width + gutterwidth
return width
endif
finally
let &eventignore = l:eventignore