diff options
author | Daniel Carl <danielcarl@gmx.de> | 2017-06-21 00:18:59 +0200 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2017-06-21 00:18:59 +0200 |
commit | e50b6492a521f79cb3ca59f79b06746f620b79ee (patch) | |
tree | 4e6fb82392edca0ef683603919af377dea89654a /src/scripts | |
parent | e2bb0199a875fafa244760cd8b651708fecd3e89 (diff) |
Shortened hint logic a little.
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/hints.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/scripts/hints.js b/src/scripts/hints.js index b13bfbd..7482ffc 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -234,11 +234,7 @@ var hints = Object.freeze((function(){ } function getMaxHintsSameLength(len) { - if (len <= 0) { - return 0; - } - - return config.hintKeys.length ** len; + return (len > 0) ? (config.hintKeys.length ** len) : 0; } function getMaxHints(maxlen) { @@ -258,7 +254,7 @@ var hints = Object.freeze((function(){ n = 0, matcher = getMatcher(filterText); - if (config.hintNumSameLength) { + if (config.keysSameLength) { /* get number of hints to be shown */ var hintCount = 0; for (i = 0; i < hints.length; i++) { @@ -471,7 +467,7 @@ var hints = Object.freeze((function(){ /* the api */ return { - init: function(mode, keepOpen, maxHints, hintKeys, followLast, hintNumSameLength) { + init: function(mode, keepOpen, maxHints, hintKeys, followLast, keysSameLength) { var prop, /* holds the xpaths for the different modes */ xpathmap = { @@ -493,10 +489,10 @@ var hints = Object.freeze((function(){ /* handle forms only useful when there are form fields in xpath */ /* don't handle form for Y to allow to yank form filed content */ /* instead of switching to input mode */ - handleForm: ("eot".indexOf(mode) >= 0), - hintKeys: hintKeys, - followLast: followLast, - hintNumSameLength: hintNumSameLength, + handleForm: ("eot".indexOf(mode) >= 0), + hintKeys: hintKeys, + followLast: followLast, + keysSameLength: keysSameLength, }; for (prop in xpathmap) { if (prop.indexOf(mode) >= 0) { |