1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-31 16:15:47 +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

View File

@@ -56,6 +56,7 @@ function CompletionContext(editor, name, offset)
self.keys = util.cloneObject(parent.keys);
delete self._generate;
delete self._filter; // FIXME?
delete self._ignoreCase;
["anchored", "compare", "editor", "filterFunc", "keys", "_process", "quote", "title", "top"].forEach(function (key)
self[key] = parent[key]);
if (self != this)
@@ -208,7 +209,11 @@ CompletionContext.prototype = {
},
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() ({
title: this.title,
@@ -222,8 +227,18 @@ CompletionContext.prototype = {
this.process = format.process || this.process;
},
// XXX
get ignoreCase() this.filter == this.filter.toLowerCase(),
get ignoreCase()
{
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()
{
@@ -318,6 +333,7 @@ CompletionContext.prototype = {
advance: function advance(count)
{
delete this._ignoreCase;
this.offset += count;
if (this.quote)
{

View File

@@ -435,15 +435,6 @@ function CommandLine() //{{{
////////////////////// 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"],
"Number of Ex commands and search patterns to store in the command-line history",
"number", 500,
@@ -478,6 +469,27 @@ function CommandLine() //{{{
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"],
"List of file patterns to ignore when completing files",
"stringlist", "",