aboutsummaryrefslogtreecommitdiffstats
path: root/x-hint.js
diff options
context:
space:
mode:
authoranekos2011-07-27 01:09:26 +0900
committeranekos2011-07-27 01:09:26 +0900
commit3577b648963b907ffd4fc31d006f4672fc7a8544 (patch)
treed0bb5d8ffe6a70b6a9543199c1b7326f9720a9cf /x-hint.js
parenta890d5778c26ddafd9389c0625c860acaafe95d0 (diff)
downloadvimperator-plugins-3577b648963b907ffd4fc31d006f4672fc7a8544.tar.bz2
エラー発生時にタグを戻す
Diffstat (limited to 'x-hint.js')
-rw-r--r--x-hint.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/x-hint.js b/x-hint.js
index 1ac450d..74caf8b 100644
--- a/x-hint.js
+++ b/x-hint.js
@@ -59,7 +59,7 @@ let PLUGIN_INFO =
// INFO {{{
let INFO =
<>
- <plugin name="X-Hint" version="1.1.2"
+ <plugin name="X-Hint" version="1.1.3"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/x-hint.js"
summary="Show the hints with given XPath."
lang="en-US"
@@ -91,7 +91,7 @@ let INFO =
</description>
</item>
</plugin>
- <plugin name="X-Hint" version="1.1.2"
+ <plugin name="X-Hint" version="1.1.3"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/x-hint.js"
summary="Show the hints with given XPath."
lang="ja"
@@ -135,6 +135,12 @@ let INFO =
function xpath ()
(last.xpath || '//a')
+ function restore () {
+ if (last.hintMode)
+ last.hintMode.tags = last.hintTags;
+ last = {};
+ }
+
plugins.libly.$U.around(
hints,
'show',
@@ -146,7 +152,13 @@ let INFO =
// override
last.hintMode.tags = xpath;
}
- return next();
+ try {
+ return next();
+ } catch (e) {
+ restore();
+ liberator.log('x-hint: restore tags for error');
+ liberator.log(e);
+ }
},
true
);
@@ -155,9 +167,7 @@ let INFO =
hints,
'hide',
function (next, [minor, filter, win]) {
- if (last.hintMode)
- last.hintMode.tags = last.hintTags;
- last = {};
+ restore();
return next();
},
true