From ce15809db36813539d60bed8dd7c683de40051cb Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 2 Dec 2013 03:00:31 +0000 Subject: [PATCH] improve tabline performance during scroll (#362). --- autoload/airline/extensions/tabline.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index b80d16e..57a473c 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -179,9 +179,15 @@ function! s:get_visible_buffers() return buffers endfunction +let s:current_bufnr = -1 +let s:current_tabline = '' function! s:get_buffers() - let b = airline#builder#new(s:builder_context) let cur = bufnr('%') + if cur == s:current_bufnr + return s:current_tabline + endif + + let b = airline#builder#new(s:builder_context) let tab_bufs = tabpagebuflist(tabpagenr()) for nr in s:get_visible_buffers() if nr < 0 @@ -207,7 +213,10 @@ function! s:get_buffers() call b.add_section('airline_tabfill', '') call b.split() call b.add_section('airline_tabtype', ' buffers ') - return b.build() + + let s:current_bufnr = cur + let s:current_tabline = b.build() + return s:current_tabline endfunction function! s:get_tabs()