mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-10 04:23:52 -05:00
improve performance of s:convert()
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
" Filename: autoload/lightline.vim
|
" Filename: autoload/lightline.vim
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2020/11/21 00:23:36.
|
" Last Change: 2020/11/21 14:03:29.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -336,13 +336,13 @@ function! s:evaluate_expand(component) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:convert(name, index) abort
|
function! s:convert(name, index) abort
|
||||||
if has_key(s:lightline.component_expand, a:name)
|
if !has_key(s:lightline.component_expand, a:name)
|
||||||
|
return [[[a:name], 0, a:index, a:index]]
|
||||||
|
else
|
||||||
let type = get(s:lightline.component_type, a:name, a:index)
|
let type = get(s:lightline.component_type, a:name, a:index)
|
||||||
let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw'
|
let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw'
|
||||||
return filter(map(s:evaluate_expand(s:lightline.component_expand[a:name]),
|
return filter(map(s:evaluate_expand(s:lightline.component_expand[a:name]),
|
||||||
\ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []')
|
\ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []')
|
||||||
else
|
|
||||||
return [[[a:name], 0, a:index, a:index]]
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user