From 60791f64af4fba16af15729f62837dddcc0b17b3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 24 Feb 2009 15:09:01 +1100 Subject: [PATCH] Ignore case in :sidebar and :dialog completion. Also fixes these to report the original arg in error messages again. --- common/content/liberator.js | 10 +++++++--- vimperator/NEWS | 2 +- vimperator/content/config.js | 13 +++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index d1d29227..7135755e 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -255,7 +255,7 @@ const liberator = (function () //{{{ "Open a " + config.name + " dialog", function (args) { - let arg = args[0].toLowerCase(); + let arg = args[0]; try { @@ -264,7 +264,7 @@ const liberator = (function () //{{{ for (let [,dialog] in Iterator(dialogs)) { - if (arg == dialog[0]) + if (util.compareIgnoreCase(arg, dialog[0]) == 0) { dialog[2](); return; @@ -281,7 +281,11 @@ const liberator = (function () //{{{ { argCount: "1", bang: true, - completer: function (context, args) completion.dialog(context) + completer: function (context) + { + context.ignoreCase = true; + return completion.dialog(context); + } }); commands.add(["em[enu]"], diff --git a/vimperator/NEWS b/vimperator/NEWS index 75c5d29a..8cd7d8b1 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -81,8 +81,8 @@ * :qa! and :q! quit forcefully, as in vim * stop macro playback on * :bmark now updates a bookmark, if possible. :bmark! adds a new one + * :dialog and :sidebar arguments are now case-insensitive * many bug fixes - * :dialog and :sidebar now doesn't care about case for arguments 2008-08-16: * version 1.2 diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 13c9c632..1a37841a 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -371,10 +371,11 @@ const config = { //{{{ "Open the sidebar window", 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 - if (document.getElementById("sidebar-title").value.toLowerCase() == arg) + if (compare(document.getElementById("sidebar-title").value, arg)) { document.getElementById("sidebar-box").focus(); return; @@ -384,7 +385,7 @@ const config = { //{{{ for (let [,panel] in Iterator(menu.childNodes)) { - if (panel.label.toLowerCase() == arg) + if (compare(panel.label, arg)) { panel.doCommand(); return; @@ -395,7 +396,11 @@ const config = { //{{{ }, { argCount: "1", - completer: function (context) completion.sidebar(context), + completer: function (context) + { + context.ignoreCase = true; + return completion.sidebar(context); + }, literal: 0 });