Skip to content

Commit

Permalink
Don't add empty segments to the buffer_segment array
Browse files Browse the repository at this point in the history
If segments for some reason are disabled (e.g. because a required plugin
isn't loaded) they shouldn't be added to the buffer_segment array.
  • Loading branch information
Lokaltog committed Jan 21, 2012
1 parent 168e5a0 commit 260ec8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autoload/Pl/Segment.vim
Expand Up @@ -158,7 +158,7 @@ function! Pl#Segment#Get(name) " {{{
let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name])
catch
" Didn't find the segment among the common segments either, just skip it
let return_segment = {}
return {}
endtry
endtry

Expand Down
9 changes: 6 additions & 3 deletions autoload/Pl/Theme.vim
Expand Up @@ -42,14 +42,17 @@ function! Pl#Theme#Buffer(ns, ...) " {{{

let segment = Pl#Segment#Get(item)

call add(segments, segment)
if ! empty(segment)
" Skip empty (possible disabled) segments
call add(segments, segment)
endif

unlet! item
endfor

return {
\ 'matches': matches,
\ 'segments': segments
\ 'matches': matches,
\ 'segments': segments
\ }
endfunction " }}}
function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{
Expand Down

0 comments on commit 260ec8f

Please sign in to comment.