Slight completion algorithm tweak

darcs
slava 2006-11-22 02:27:39 +00:00
parent 2b70b79874
commit dfef2d2ad8
2 changed files with 8 additions and 5 deletions

View File

@ -3,12 +3,8 @@
- "ker" C+u: for a moment, full vocab list is shown
- some module operations don't work on module-links
- list operations: what if nothing is selected?
- list usability
- popup: -- close button
- popup: -- pin button
- modules: core/ libs/ apps/
- top level window positioning on ms windows
- completion is not ideal: eg, C+e "buttons"
- crashes:
- windows gcc issue
- robustify stepper -- see if step back past a throw works

View File

@ -55,9 +55,16 @@ USING: kernel arrays sequences math namespaces strings io ;
[ first < ] subset-with
[ second ] map ;
: complete ( full short -- score )
#! Match forwards and backwards, see which one has the
#! highest score.
[ dupd fuzzy score ] 2keep
[ <reversed> ] 2apply
dupd fuzzy score max ;
: completion ( str quot obj -- pair )
#! pair is { obj score }
[ swap call dup rot fuzzy score ] keep 2array ; inline
[ swap call swap complete ] keep 2array ; inline
: completions ( str quot candidates -- seq )
pick empty? [