diff --git a/content/bookmarks.js b/content/bookmarks.js index db59a754..399d31a8 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -258,7 +258,7 @@ function Bookmarks() //{{{ for (var i = 0; i < items.length; i++) { - var list = ""; + var list = "
titlekeywordURLtags
"; for (var i = 0; i < items.length; i++) { var title = items[i][1].replace(//, ">"); @@ -488,7 +488,7 @@ function History() //{{{ for (var i = 0; i < items.length; i++) { - var list = "
titlekeywordURLtags
"; + var list = "
titleURL
"; for (var i = 0; i < items.length; i++) { var title = items[i][1].replace(//, ">"); @@ -743,11 +743,11 @@ function Marks() //{{{ } } - var list = "
titleURL
"; + var list = "
marklinecolfile
"; for (var i = 0; i < marks.length; i++) { list += "" - + "" + + "" + "" + "" + "" @@ -838,10 +838,10 @@ function QuickMarks() //{{{ } } - var list = "
marklinecolfile
 " + marks[i][0] + " " + marks[i][0] + "" + Math.round(marks[i][1].position.y * 100) + "%" + Math.round(marks[i][1].position.x * 100) + "%" + marks[i][1].location.replace(//, ">") + "
"; + var list = "
QuickMarkURL
"; for (var i = 0; i < marks.length; i++) { - list += ""; } list += "
QuickMarkURL
    " + marks[i][0] + + list += "
" + marks[i][0] + "" + marks[i][1].replace(//, ">") + "
"; diff --git a/content/buffers.js b/content/buffers.js index c5835d68..0c6b4bee 100644 --- a/content/buffers.js +++ b/content/buffers.js @@ -232,22 +232,22 @@ function Buffer() //{{{ var items = vimperator.completion.get_buffer_completions(""); var number, indicator, title, url; - var list = "" + var list = "
" for (var i = 0; i < items.length; i++) { if (i == vimperator.tabs.index()) - indicator = " % "; + indicator = " % "; else if (i == vimperator.tabs.index(vimperator.tabs.alternate)) - indicator = " # "; + indicator = " # "; else - indicator = "   "; + indicator = " "; [number, title] = items[i][0].split(/:\s+/, 2); url = items[i][1]; url = url.replace(/>/, ">").replace(//, ">").replace(/"; } diff --git a/content/commands.js b/content/commands.js index 59721ba2..5cfaa6f3 100644 --- a/content/commands.js +++ b/content/commands.js @@ -1426,25 +1426,30 @@ function Commands() //{{{ var after_time = Date.now(); if ((after_time - before_time) / count >= 100) - var each = "  Each time:  " + + var each = ""; else - var each = "  Each time:  " + + var each = ""; if (after_time - before_time >= 100) - var total = "  Total time: " + + var total = ""; else - var total = "  Total time: " + - (after_time - before_time) + " msec"; + var total = ""; + var str = "
  " + number + "" + indicator + + list += "
" + number + "" + indicator + "" + title + "" + url + "
Each time:" + ((after_time - before_time) / 1000.0 / count) + - " sec
"; + "
sec Each time:" + ((after_time - before_time) / count) + - " msec
"; + "
msec Total time:" + ((after_time - before_time) / 1000.0) + - " sec"; + "sec Total time:" + + (after_time - before_time) + "msec
" + + "" + + "" + + "" + each + "" + + "" + total + "" + "
Code execution summary
Executed:" + count + "times
"; - vimperator.echo("Code execution summary:
" + - "  Executed:   " + count + " times
" + each + total); + vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, true); } else { diff --git a/content/mappings.js b/content/mappings.js index 3ee53b90..7e4d7271 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -288,9 +288,9 @@ function Mappings() //{{{ for (var j = 0; j < maps[i].names.length; j++) { list += ""; - list += " " + maps[i].names[j].replace(//g, ">") + "" + list += " " + maps[i].names[j].replace(//g, ">") + "" if (maps[i].rhs) - list += " " + maps[i].rhs.replace(//g, ">") + "" + list += " " + maps[i].rhs.replace(//g, ">") + "" list += ""; } } diff --git a/content/options.js b/content/options.js index 060a28f3..cc12208a 100644 --- a/content/options.js +++ b/content/options.js @@ -304,8 +304,8 @@ function Options() //{{{ this.list = function() { // TODO: columns like Vim? - var list = "" + - ""; + var list = "
--- Options ---
" + + ""; var name, value; for (var i = 0; i < options.length; i++) @@ -315,12 +315,12 @@ function Options() //{{{ if (options[i].type == "boolean") { - name = value ? "  " + name : "no" + name; + name = value ? " " + name : "no" + name; list += ""; } else { - list += ""; + list += ""; } } diff --git a/content/ui.js b/content/ui.js index 6963196a..fc4d9366 100644 --- a/content/ui.js +++ b/content/ui.js @@ -138,7 +138,7 @@ function CommandLine() //{{{ commandline_widget.setAttribute("class", group); } - // Sets the prompt - for example, : or / + // sets the prompt - for example, : or / function setPrompt(prompt) { if (typeof prompt != "string") @@ -147,7 +147,7 @@ function CommandLine() //{{{ prompt_widget.value = prompt; if (prompt) { - // Initially (in the xul) the prompt is 'collapsed', this makes + // initially (in the xul) the prompt is 'collapsed', this makes // sure it's visible, then we toggle the display which works better prompt_widget.style.visibility = 'visible'; prompt_widget.style.display = 'inline'; @@ -159,16 +159,15 @@ function CommandLine() //{{{ } } - // Sets the command - e.g. 'tabopen', 'open http://example.com/' + // sets the command - e.g. 'tabopen', 'open http://example.com/' function setCommand(cmd) { command_widget.value = cmd; } - // TODO: the invoking command should be pasted at the top of the MOW and - // the MOW messages should actually be displayed in the commandline - // : extract CSS + // TODO: extract CSS // : resize upon a window resize + // : echoed lines longer than v-c-c.width should wrap and use MOW function setMultiline(str) { // TODO: we should retain any previous command output like Vim @@ -177,16 +176,18 @@ function CommandLine() //{{{ multiline_input_widget.collapsed = true; - var output = "
" + str + "
"; - output += 'Press ENTER or type command to continue'; - output += ''; - output += ''; + var output = ":" + command_widget.value + "
" + str; + + var font_size = document.defaultView.getComputedStyle(document.getElementById("main-window"), null).getPropertyValue("font-size"); + multiline_output_widget.contentDocument.body.setAttribute("style", "font-size: " + font_size); multiline_output_widget.contentDocument.body.innerHTML = output; + multiline_output_widget.contentDocument.body.id = "vimperator-multiline-output-content"; + + var stylesheet = multiline_output_widget.contentDocument.createElement("link"); + stylesheet.setAttribute("rel", "Stylesheet"); + stylesheet.setAttribute("href", "chrome://vimperator/skin/vimperator.css"); + multiline_output_widget.contentDocument.getElementsByTagName("head")[0].appendChild(stylesheet); var available_height = getBrowser().mPanelContainer.boxObject.height; var content_height = multiline_output_widget.contentDocument.height; @@ -197,12 +198,17 @@ function CommandLine() //{{{ if (vimperator.options["more"] && multiline_output_widget.contentWindow.scrollMaxY > 0) { - multiline_output_widget.contentWindow.document.getElementById("more-prompt").style.display = "inline"; + setHighlightGroup("hl-MoreMsg"); + setPrompt(""); + setCommand("-- More --"); multiline_output_widget.contentWindow.scrollTo(0, 0); } else { multiline_output_widget.contentWindow.scrollTo(0, content_height); + setHighlightGroup("hl-Question"); + setPrompt(""); + setCommand('Press ENTER or type command to continue'); } multiline_output_widget.contentWindow.focus(); @@ -264,7 +270,7 @@ function CommandLine() //{{{ command_widget.focus(); }; - /* normally used when pressing esc, does not execute a command */ + // normally used when pressing esc, does not execute a command this.close = function() { var res = vimperator.triggerCallback("cancel", cur_extended_mode); @@ -476,7 +482,7 @@ function CommandLine() //{{{ if (res) [completion_start_index, completions] = res; - // Sort the completion list + // sort the completion list if (vimperator.options["wildoptions"].search(/\bsort\b/) > -1) { completions.sort(function(a, b) { @@ -634,6 +640,7 @@ function CommandLine() //{{{ var show_more_help_prompt = false; var show_more_prompt = false; + var clear_prompt = false; function isScrollable() { return !win.scrollMaxY == 0; } @@ -641,9 +648,9 @@ function CommandLine() //{{{ function close() { - multiline_output_widget.collapsed = true; // FIXME: use mode stack vimperator.modes.reset(); + clear_prompt = true; } function pass(event) @@ -657,7 +664,7 @@ function CommandLine() //{{{ switch (key) { case ":": - vimperator.commandline.open(":", "", vimperator.modes.EX); + pass(event); break; // down a line @@ -786,22 +793,27 @@ function CommandLine() //{{{ } // set appropriate prompt string - var more_prompt = win.document.getElementById("more-prompt"); - var more_help_prompt = win.document.getElementById("more-help-prompt"); - - if (show_more_help_prompt) + if (clear_prompt) { - more_prompt.style.display = "none"; - more_help_prompt.style.display = "inline"; + this.clear(); + } + else if (show_more_help_prompt) + { + setHighlightGroup(this.HL_MOREMSG); + setPrompt(""); + setCommand("-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit"); } else if (show_more_prompt || (vimperator.options["more"] && isScrollable() && !atEnd())) { - more_help_prompt.style.display = "none"; - more_prompt.style.display = "inline"; + setHighlightGroup(this.HL_MOREMSG); + setPrompt(""); + setCommand("-- More --"); } else { - more_prompt.style.display = more_help_prompt.style.display = "none"; + setHighlightGroup(this.HL_QUESTION); + setPrompt(""); + setCommand('Press ENTER or type command to continue'); } } diff --git a/content/vimperator.js b/content/vimperator.js index f73c82a1..d99b9dcc 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -363,7 +363,7 @@ const vimperator = (function() //{{{ } if (color) - string += "" + obj + "::\n"; + string += "" + obj + "::\n"; else string += obj + "::\n"; diff --git a/skin/vimperator.css b/skin/vimperator.css index 3f7b9bc1..dc3fd418 100644 --- a/skin/vimperator.css +++ b/skin/vimperator.css @@ -114,6 +114,8 @@ the terms of any one of the MPL, the GPL or the LGPL. background-color: black; } +/* highlight groups */ + .hl-Normal { background-color: white; color: black; @@ -145,4 +147,44 @@ the terms of any one of the MPL, the GPL or the LGPL. color: red; } +.hl-Normal { + background-color: white; + color: black; +} +.hl-ErrorMsg { + background-color: red; + color: white; + font-weight: bold; +} +.hl-MoreMsg { + color: green; + background-color: white; +} +.hl-Title { + color: magenta; + background-color: white; + font-weight: bold; +} + +/* MOW */ + +#vimperator-multiline-output-content { + white-space: pre; /* -moz-pre-wrap FIXME: Should lines wrap like Vim? */ + font-family: -moz-fixed; + margin: 0px; +} + +#vimperator-multiline-output-content * { + font: inherit; +} + +#vimperator-multiline-output-content table { + white-space: inherit; + border-spacing: 0px; +} + +#vimperator-multiline-output-content td { + padding: 0px; +} + /* vim: set fdm=marker sw=4 ts=4 et: */
--- Options ---
" + name + "
" + "  " + name + "=" + value + "
" + " " + name + "=" + value + "