From a68fc7ad20e847e926e0184aecf63c881fee5269 Mon Sep 17 00:00:00 2001 From: hogelog Date: Tue, 27 Jan 2009 14:29:09 +0000 Subject: * revert g:hintsio setting git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@29135 d0d07461-0603-4401-acd4-de1884942a52 --- char-hints-mod2.js | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/char-hints-mod2.js b/char-hints-mod2.js index 248aa58..139f87a 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -21,12 +21,14 @@ let g:hintchars: set character used by char-hint. e.g.) let g:hintchars="hjkl" -let g:hintsinput: +let g:hintsio: - "i" setting char-hint input lowercase. - "I" setting char-hint input uppercase. - Default setting is "I". + - "o" setting char-hint show lowercase. + - "O" setting char-hint show uppercase. + Default setting is "IO". e.g.) - let g:hintinput="i" + let g:histsio="i" == TODO == ]]> @@ -41,12 +43,14 @@ let g:hintchars: set character used by char-hint. e.g.) let g:hintchars="hjkl" -let g:hintinput: +let g:hintsio: - "i" setting char-hint input lowercase. - "I" setting char-hint input uppercase. - Default setting is "I". + - "o" setting char-hint show lowercase. + - "O" setting char-hint show uppercase. + Default setting is "IO". e.g.) - let g:hintinput="i" + let g:histsio="i" == TODO == ]]> @@ -61,6 +65,7 @@ let g:hintinput: let hintchars = DEFAULT_HINTCHARS; let inputCase = function(str) str.toUpperCase(); let inputRegex = /[A-Z]/; + let showCase = function(str) str.toUpperCase(); function chars2num(chars) //{{{ { @@ -109,7 +114,7 @@ let g:hintinput: let hint = hints[i]; let num = hint.getAttribute("number"); let hintchar = num2chars(parseInt(num, 10)+start); - hint.setAttribute("hintchar", hintchar.toUpperCase()); + hint.setAttribute("hintchar", showCase(hintchar)); } } //}}} function isValidHint(hintInput, hint) //{{{ @@ -118,6 +123,26 @@ let g:hintinput: let hintchar = hint.getAttribute("hintchar"); return inputCase(hintchar).indexOf(hintInput) == 0; } //}}} + function setIOType(type) //{{{ + { + switch (type) + { + case "I": + inputCase = function(str) str.toUpperCase(); + inputRegex = /[A-Z]/; + break; + case "i": + inputCase = function(str) str.toLowerCase(); + inputRegex = /[a-z]/; + break; + case "O": + showCase = function(str) str.toUpperCase(); + break; + case "o": + showCase = function(str) str.toLowerCase(); + break; + } + } //}}} function processHintInput(hintInput, hints) //{{{ { let start = getStartNum(hintchars.length, hints.length); @@ -209,9 +234,9 @@ let g:hintinput: liberator.eval("onInput = plugins.charhints.onInput", hintContext); liberator.execute(":hi Hint::after content: attr(hintchar)", true, true); - if(liberator.globalVariables.hintsinput) { - let hintsinput = liberator.globalVariables.hintsinput; - setInputCase(liberator.globalVariables.hintsinput); + if(liberator.globalVariables.hintsio) { + let hintsio = liberator.globalVariables.hintsio; + for(let i=hintsio.length;i-->0;setIOType(hintsio[i])); } if(liberator.globalVariables.hintchars) { hintchars = liberator.globalVariables.hintchars; -- cgit v1.2.3