1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 16:12:26 +01:00

Add 'wildcase' option

This commit is contained in:
Kris Maglione
2008-11-28 05:07:23 +00:00
parent 2ef031c756
commit 5e732e3bf1
6 changed files with 71 additions and 12 deletions

3
NEWS
View File

@@ -16,6 +16,9 @@
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively VimperatorLeave respectively
* add 'wildcase' option
* 'linkbgcolor', 'linkfgcolor', ... have been replaced with highlight
groups, HintElem and HintActive
* new 'followhints' option * new 'followhints' option
* :buffers supports a filter now to only list buffers matching filter (vim * :buffers supports a filter now to only list buffers matching filter (vim
incompatible, but consistent with other commands) incompatible, but consistent with other commands)

View File

@@ -56,6 +56,7 @@ function CompletionContext(editor, name, offset)
self.keys = util.cloneObject(parent.keys); self.keys = util.cloneObject(parent.keys);
delete self._generate; delete self._generate;
delete self._filter; // FIXME? delete self._filter; // FIXME?
delete self._ignoreCase;
["anchored", "compare", "editor", "filterFunc", "keys", "_process", "quote", "title", "top"].forEach(function (key) ["anchored", "compare", "editor", "filterFunc", "keys", "_process", "quote", "title", "top"].forEach(function (key)
self[key] = parent[key]); self[key] = parent[key]);
if (self != this) if (self != this)
@@ -208,7 +209,11 @@ CompletionContext.prototype = {
}, },
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret), get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret),
set filter(val) this._filter = val, set filter(val)
{
delete this._ignoreCase;
return this._filter = val
},
get format() ({ get format() ({
title: this.title, title: this.title,
@@ -222,8 +227,18 @@ CompletionContext.prototype = {
this.process = format.process || this.process; this.process = format.process || this.process;
}, },
// XXX get ignoreCase()
get ignoreCase() this.filter == this.filter.toLowerCase(), {
if ("_ignoreCase" in this)
return this._ignoreCase;
let mode = options["wildcase"];
if (mode == "match")
return this._ignoreCase = false;
if (mode == "ignore")
return this._ignoreCase = true;
return this._ignoreCase = !/[A-Z]/.test(this.filter);
},
set ignoreCase(val) this._ignoreCase = val,
get items() get items()
{ {
@@ -318,6 +333,7 @@ CompletionContext.prototype = {
advance: function advance(count) advance: function advance(count)
{ {
delete this._ignoreCase;
this.offset += count; this.offset += count;
if (this.quote) if (this.quote)
{ {

View File

@@ -435,15 +435,6 @@ function CommandLine() //{{{
////////////////////// OPTIONS ///////////////////////////////////////////////// ////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
// TODO: doesn't belong in ui.js
options.add(["complete", "cpt"],
"Items which are completed at the :[tab]open prompt",
"charlist", "sfl",
{
completer: function completer(filter) [k for each (k in completion.urlCompleters)],
validator: options.validateCompleter
});
options.add(["history", "hi"], options.add(["history", "hi"],
"Number of Ex commands and search patterns to store in the command-line history", "Number of Ex commands and search patterns to store in the command-line history",
"number", 500, "number", 500,
@@ -478,6 +469,27 @@ function CommandLine() //{{{
validator: options.validateCompleter validator: options.validateCompleter
}); });
// TODO: these belong in ui.js
options.add(["complete", "cpt"],
"Items which are completed at the :[tab]open prompt",
"charlist", "sfl",
{
completer: function completer(filter) [k for each (k in completion.urlCompleters)],
validator: options.validateCompleter
});
options.add(["wildcase", "wic"],
"Completion case matching mode",
"string", "smart",
{
completer: function () [
["smart", "Case is significant when capital letters are typed"],
["match", "Case is always significant"],
["ignore", "Case is never significant"]
],
validator: options.validateCompleter
});
options.add(["wildignore", "wig"], options.add(["wildignore", "wig"],
"List of file patterns to ignore when completing files", "List of file patterns to ignore when completing files",
"stringlist", "", "stringlist", "",

View File

@@ -308,6 +308,7 @@ section:Options[option-index]
||'usermode'|| Show current website with a minimal style sheet to make it easily accessible + ||'usermode'|| Show current website with a minimal style sheet to make it easily accessible +
||'verbose'|| Define which info messages are displayed + ||'verbose'|| Define which info messages are displayed +
||'visualbell'|| Use visual bell instead of beeping on errors + ||'visualbell'|| Use visual bell instead of beeping on errors +
||'wildcase'|| Completion case matching mode +
||'wildignore'|| List of file patterns to ignore when completing files + ||'wildignore'|| List of file patterns to ignore when completing files +
||'wildmode'|| Define how command-line completion works + ||'wildmode'|| Define how command-line completion works +
||'wildoptions'|| Change how command-line completion is done + ||'wildoptions'|| Change how command-line completion is done +

View File

@@ -743,6 +743,19 @@ this option.
____ ____
|\'wildcase'| |\'wic'|
||'wildcase' 'wic'|| string (default: "smart")
____
Defines how completions are matched with regard to character case.
`---------------`------------------------
"smart" Case is significant when capital letters are typed
"match" Case is always significant
"ignore" Case is never significant
-----------------------------------------
____
|\'wildignore'| |\'wig'| |\'wildignore'| |\'wig'|
||'wildignore' 'wig'|| stringlist (default: "") ||'wildignore' 'wig'|| stringlist (default: "")
____ ____

View File

@@ -30,15 +30,29 @@ Valid groups are:
`------------------`----------------------------------- `------------------`-----------------------------------
*Bell* Vimperator's visual bell *Bell* Vimperator's visual bell
*Boolean* A JavaScript Boolean object *Boolean* A JavaScript Boolean object
*CompDesc* The description column of the completion list
*CompIcon* The favicon of a completion row
*CompItem* A completion row
*CompLess* The indicator shown when completions may be scrolled up
*CompMore* The indicator shown when completions may be scrolled down
*CompResult* The result column of the completion list
*CompTitle* Completion row titles
*ErrorMsg* Error messages *ErrorMsg* Error messages
*Filter* The matching text in a completion list *Filter* The matching text in a completion list
*FrameIndicator* The indicator shown when a new frame is selected
*Function* A JavaScript Function object *Function* A JavaScript Function object
*Hint* A hint indicator. See [c]:help hints[c]. *Hint* A hint indicator. See [c]:help hints[c].
*HintActive* The hint element which will be selected on <Enter>
*HintElem* The element which a hint refers to.
*HintImage* The indicator which floats above hinted images.
*Indicator*
*InfoMsg* Information messages *InfoMsg* Information messages
*Keyword* A bookmark keyword for a URL *Keyword* A bookmark keyword for a URL
*LineNr* The line number of an error *LineNr* The line number of an error
*Message*
*ModeMsg* The mode indicator in the command line *ModeMsg* The mode indicator in the command line
*MoreMsg* The indicator that there is more text to view *MoreMsg* The indicator that there is more text to view
*NonText*
*Normal* Normal text in the command line *Normal* Normal text in the command line
*Null* A JavaScript Null object *Null* A JavaScript Null object
*Number* A JavaScript Number object *Number* A JavaScript Number object