Permalink
Browse files

use Data.OrderedSet for deduplicate candidates. (fix #125)

  • Loading branch information...
1 parent 9f7a4da commit 27046b31470131e17143abf26ceefea6e3a69e89 @tyru committed May 24, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 autoload/eskk/table.vim
View
@@ -174,23 +174,26 @@ function! s:AbstractTable_get_candidates(lhs_head, ...) dict "{{{
\)
endfunction "}}}
function! s:get_candidates(table, lhs_head, ...) "{{{
- let candidates = filter(
+ " Search in this table.
+ let candidates = eskk#util#create_data_ordered_set()
+ call candidates.append(filter(
\ keys(a:table.load()),
\ '!stridx(v:val, a:lhs_head)'
- \)
+ \))
+
+ " Search in base tables.
if a:table.is_child()
- " Search base tables.
for base in a:table._bases
- let candidates += s:get_candidates(
+ call candidates.append(s:get_candidates(
\ base,
\ a:lhs_head,
\ []
- \)
+ \))
endfor
endif
- if !empty(candidates)
- return candidates
+ if !candidates.empty()
+ return candidates.to_list()
endif
" No lhs_head in a:table and its base tables.

0 comments on commit 27046b3

Please sign in to comment.