From 3baf614b118b09cd2dab9dd5958bd52f68e7bef3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 18 Sep 2007 16:30:39 +0000 Subject: [PATCH] use build_longest_common_substring rather than build_longest_starting_substring for :sidebar completion --- chrome/content/vimperator/completion.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index 3a6603f8..0c02f520 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -467,9 +467,16 @@ vimperator.completion = (function() // {{{ var nodes = []; for (var i = 0; i < menu.childNodes.length; i++) - nodes.push([[menu.childNodes[i].label], ""]); + nodes.push([menu.childNodes[i].label, ""]); + + if (!filter) + return nodes; + + var mapped = nodes.map(function($_) { + return [[$_[0]], $_[1]]; + }); - return build_longest_starting_substring(nodes, filter); + return build_longest_common_substring(mapped, filter); }, //}}} exTabCompletion: function(str) //{{{