1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-12 14:45:46 +01:00

Ignore case in :sidebar and :dialog completion.

Also fixes these to report the original arg in error messages again.
This commit is contained in:
Doug Kearns
2009-02-24 15:09:01 +11:00
parent e318da7073
commit 60791f64af
3 changed files with 17 additions and 8 deletions

View File

@@ -255,7 +255,7 @@ const liberator = (function () //{{{
"Open a " + config.name + " dialog", "Open a " + config.name + " dialog",
function (args) function (args)
{ {
let arg = args[0].toLowerCase(); let arg = args[0];
try try
{ {
@@ -264,7 +264,7 @@ const liberator = (function () //{{{
for (let [,dialog] in Iterator(dialogs)) for (let [,dialog] in Iterator(dialogs))
{ {
if (arg == dialog[0]) if (util.compareIgnoreCase(arg, dialog[0]) == 0)
{ {
dialog[2](); dialog[2]();
return; return;
@@ -281,7 +281,11 @@ const liberator = (function () //{{{
{ {
argCount: "1", argCount: "1",
bang: true, bang: true,
completer: function (context, args) completion.dialog(context) completer: function (context)
{
context.ignoreCase = true;
return completion.dialog(context);
}
}); });
commands.add(["em[enu]"], commands.add(["em[enu]"],

View File

@@ -81,8 +81,8 @@
* :qa! and :q! quit forcefully, as in vim * :qa! and :q! quit forcefully, as in vim
* stop macro playback on <C-c> * stop macro playback on <C-c>
* :bmark now updates a bookmark, if possible. :bmark! adds a new one * :bmark now updates a bookmark, if possible. :bmark! adds a new one
* :dialog and :sidebar arguments are now case-insensitive
* many bug fixes * many bug fixes
* :dialog and :sidebar now doesn't care about case for arguments
2008-08-16: 2008-08-16:
* version 1.2 * version 1.2

View File

@@ -371,10 +371,11 @@ const config = { //{{{
"Open the sidebar window", "Open the sidebar window",
function (args) function (args)
{ {
let arg = args.literalArg.toLowerCase(); let arg = args.literalArg;
function compare(a, b) util.compareIgnoreCase(a, b) == 0
// focus if the requested sidebar is already open // focus if the requested sidebar is already open
if (document.getElementById("sidebar-title").value.toLowerCase() == arg) if (compare(document.getElementById("sidebar-title").value, arg))
{ {
document.getElementById("sidebar-box").focus(); document.getElementById("sidebar-box").focus();
return; return;
@@ -384,7 +385,7 @@ const config = { //{{{
for (let [,panel] in Iterator(menu.childNodes)) for (let [,panel] in Iterator(menu.childNodes))
{ {
if (panel.label.toLowerCase() == arg) if (compare(panel.label, arg))
{ {
panel.doCommand(); panel.doCommand();
return; return;
@@ -395,7 +396,11 @@ const config = { //{{{
}, },
{ {
argCount: "1", argCount: "1",
completer: function (context) completion.sidebar(context), completer: function (context)
{
context.ignoreCase = true;
return completion.sidebar(context);
},
literal: 0 literal: 0
}); });