use columns instead of winwidth (#222).

This commit is contained in:
Bailey Ling 2013-09-25 19:26:25 +00:00
parent e507f481a2
commit 4d706c5f4a

View File

@ -124,12 +124,13 @@ function! s:get_visible_buffers()
" only show current and surrounding buffers if there are too many buffers " only show current and surrounding buffers if there are too many buffers
let position = index(buffers, cur) let position = index(buffers, cur)
if total_width > winwidth(0) && position > -1 let vimwidth = &columns
if total_width > vimwidth && position > -1
let buf_count = len(buffers) let buf_count = len(buffers)
" determine how many buffers to show based on the longest buffer width, " determine how many buffers to show based on the longest buffer width,
" use one on the right side and put the rest on the left " use one on the right side and put the rest on the left
let buf_max = winwidth(0) / max_width let buf_max = vimwidth / max_width
let buf_right = 1 let buf_right = 1
let buf_left = max([0, buf_max - buf_right]) let buf_left = max([0, buf_max - buf_right])