aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-05-28 11:43:35 +0000
committeranekos2010-05-28 11:43:35 +0000
commitaa308c7931735d89623189bea737bfe94e0b4409 (patch)
tree0fb660a6956f5e432672f395aac64c7b28fab876
parent004684b149597c60e4eee439425f7b93948ee833 (diff)
downloadvimperator-plugins-aa308c7931735d89623189bea737bfe94e0b4409.tar.bz2
補完のコスト改善
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37744 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-xgmail-commando.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/gmail-commando.js b/gmail-commando.js
index 5247d44..44a7fb7 100755
--- a/gmail-commando.js
+++ b/gmail-commando.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
<name lang="ja">GMail コマンドー</name>
<description>The handy commands for GMail</description>
<description lang="ja">便利なGMail用コマンドー</description>
- <version>1.2.0</version>
+ <version>1.3.0</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -57,7 +57,7 @@ let PLUGIN_INFO =
// INFO {{{
let INFO =
<>
- <plugin name="GMailCommando" version="1.2.0"
+ <plugin name="GMailCommando" version="1.3.0"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js"
summary="The handy commands for GMail"
lang="en-US"
@@ -72,7 +72,7 @@ let INFO =
<description><p></p></description>
</item>
</plugin>
- <plugin name="GMailコマンドー" version="1.2.0"
+ <plugin name="GMailコマンドー" version="1.3.0"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js"
summary="便利なGMail用コマンドー"
lang="ja"
@@ -250,14 +250,19 @@ let INFO =
const KeywordValueCompleter = {
__noSuchMethod__: function () void 0,
- label: function (context) {
- let completions = [
- [label.textContent.replace(/\s*\(\d+\+?\)$/, ''), label.textContent]
- for ([, label] in Iterator(Commando.inGmail ? Elements.labels : Commando.storage.get('labels', [])))
+ // XXX storage はちょっと重いっぽいので、ちょっと工夫する
+ label: let (last = []) function (context) {
+ if (Commando.inGmail) {
+ var labels = Elements.labels.map(function (it) it.textContent);
+ if (last.toString() != labels)
+ Commando.storage.set('labels', labels);
+ } else {
+ var labels = last.length ? last : Commando.storage.get('labels', []);
+ }
+ context.completions = [
+ [label.replace(/\s*\(\d+\+?\)$/, ''), label]
+ for ([, label] in Iterator(labels))
];
- if (Commando.inGmail)
- Commando.storage.set('labels', Elements.labels);
- context.completions = completions;
},
is: function (context) {