mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-12 13:33:50 -05:00
do not sort in s:unique and rename it to s:uniq
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/03/24 21:29:36.
|
||||
" Last Change: 2016/03/24 21:35:29.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
@@ -256,20 +256,18 @@ function! s:term(l) abort
|
||||
endfunction
|
||||
|
||||
if exists('*uniq')
|
||||
function! s:unique(xs) abort
|
||||
return uniq(sort(a:xs))
|
||||
function! s:uniq(xs) abort
|
||||
return uniq(a:xs)
|
||||
endfunction
|
||||
else
|
||||
function! s:unique(xs) abort
|
||||
call sort(a:xs)
|
||||
let i = 0
|
||||
let l = len(a:xs) - 1
|
||||
while i < l
|
||||
if a:xs[i] ==# a:xs[i + 1]
|
||||
call remove(a:xs, i + 1)
|
||||
let l -= 1
|
||||
function! s:uniq(xs) abort
|
||||
let i = len(a:xs) - 1
|
||||
while 0 < i
|
||||
if a:xs[i] ==# a:xs[i - 1]
|
||||
call remove(a:xs, i)
|
||||
let i -= 2
|
||||
else
|
||||
let i += 1
|
||||
let i -= 1
|
||||
endif
|
||||
endwhile
|
||||
return a:xs
|
||||
@@ -289,7 +287,7 @@ function! lightline#highlight(...) abort
|
||||
endif
|
||||
let [s:lightline.llen, s:lightline.rlen] = [len(c.normal.left), len(c.normal.right)]
|
||||
let [s:lightline.tab_llen, s:lightline.tab_rlen] = [len(has_key(c,'tabline') && has_key(c.tabline, 'left') ? c.tabline.left : c.normal.left), len(has_key(c,'tabline') && has_key(c.tabline, 'right') ? c.tabline.right : c.normal.right)]
|
||||
let h = s:unique(filter(values(g), 'v:val !=# "raw"'))
|
||||
let h = s:uniq(sort(filter(values(g), 'v:val !=# "raw"')))
|
||||
let modes = a:0 ? [a:1] : extend(['normal', 'insert', 'replace', 'visual', 'inactive', 'command', 'select', 'tabline'], has('nvim') ? ['terminal'] : [])
|
||||
for mode in modes
|
||||
let s:highlight[mode] = 1
|
||||
|
||||
Reference in New Issue
Block a user