From: Daniel Carl Date: Tue, 20 Jun 2017 22:18:59 +0000 (+0200) Subject: Shortened hint logic a little. X-Git-Url: https://git.owens.tech/dummy.html/dummy.html/git?a=commitdiff_plain;h=e50b6492a521f79cb3ca59f79b06746f620b79ee;p=vimb.git Shortened hint logic a little. --- 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) {