diff --git a/NEWS b/NEWS index 279d2b02..acb3c187 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ 2007-xx-xx: * version 0.6 * THIS VERSION ONLY WORKS WITH FIREFOX 3.0 + * :buffer partial_string works now as in vim, and with ! even better * new :time command for profiling * added new :sidebar and :sbclose commands * added 'more' and standard more-prompt key mappings to control diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 261390bd..6320e792 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -318,22 +318,40 @@ function Commands() //{{{ )); addDefaultCommand(new Command(["b[uffer]"], // TODO: move to v.tabs/buffers - function(args) + function(args, special) { var match; if (match = args.match(/^(\d+):?/)) return vimperator.tabs.select(parseInt(match[1]) - 1, false); // make it zero-based + + var matches = []; + var lower_args = args.toLowerCase(); + var first = vimperator.tabs.index() + 1; for (var i = 0; i < getBrowser().browsers.length; i++) { - var url = getBrowser().getBrowserAtIndex(i).contentDocument.location.href; + var index = (i + first) % getBrowser().browsers.length; + var url = getBrowser().getBrowserAtIndex(index).contentDocument.location.href; + var title = getBrowser().getBrowserAtIndex(index).contentDocument.title.toLowerCase(); if (url == args) - return vimperator.tabs.select(i, false); + return vimperator.tabs.select(index, false); + + if (url.indexOf(args) >= 0 || title.indexOf(lower_args) >= 0) + matches.push(index); } + if (matches.length == 0) + vimperator.echoerr("E94: No matching buffer for " + args); + else if (matches.length > 1 && !special) + vimperator.echoerr("E93: More than one match for " + args); + else + vimperator.tabs.select(matches[0], false); }, { - usage: ["b[uffer] {url|index}"], + usage: ["b[uffer][!] {url|index}"], short_help: "Go to buffer from buffer list", help: "Argument can be either the buffer index or the full URL.
" + + "If argument is neither a full URL nor an index but uniquely identifies a buffer, " + + "it is selected. With [!] the next buffer matching the argument " + + "is selected, even if it cannot be identified uniquely.
" + "Use b as a shortcut to open this prompt.", completer: function(filter) { return vimperator.completion.get_buffer_completions(filter); } } @@ -1324,25 +1342,25 @@ function Commands() //{{{ var after_time = Date.now(); if ((after_time - before_time) / count >= 100) - var each = " Each time: " + + var each = "  Each time:  " + ((after_time - before_time) / 1000.0 / count) + " sec
"; else - var each = " Each time: " + + var each = "  Each time:  " + ((after_time - before_time) / count) + " msec
"; if (after_time - before_time >= 100) - var total = " Total time: " + + var total = "  Total time: " + ((after_time - before_time) / 1000.0) + - " sec"; + " sec"; else - var total = " Total time: " + - (after_time - before_time) + " msec"; + var total = "  Total time: " + + (after_time - before_time) + " msec"; - vimperator.echo("
Code execution summary:
" + - " Executed: " + count + " times
" + each + total); + vimperator.echo("Code execution summary:
" + + "  Executed:   " + count + " times
" + each + total); } else { diff --git a/chrome/content/vimperator/events.js b/chrome/content/vimperator/events.js index ab533a36..e7b632dc 100644 --- a/chrome/content/vimperator/events.js +++ b/chrome/content/vimperator/events.js @@ -566,8 +566,11 @@ function Events() //{{{ // XXX: ugly hack for now pass certain keys to firefox as they are without beeping // also fixes key navigation in combo boxes, etc. - if (key == "" || key == "")// || key == "" || key == "" || key == "" || key == "") - return false; + if (vimperator.mode == vimperator.modes.NORMAL) + { + if (key == "" || key == "" || key == "" || key == "" || key == "" || key == "") + return false; + } // // FIXME: handle middle click in content area {{{