diff --git a/content/bookmarks.js b/content/bookmarks.js
index c996c5ab..db59a754 100644
--- a/content/bookmarks.js
+++ b/content/bookmarks.js
@@ -276,7 +276,7 @@ function Bookmarks() //{{{
}
list += "";
- vimperator.commandline.echo(list, true);
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}
}
@@ -499,7 +499,7 @@ function History() //{{{
}
list += "";
- vimperator.commandline.echo(list, true);
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}
}
@@ -755,7 +755,7 @@ function Marks() //{{{
}
list += "";
- vimperator.commandline.echo(list, true); // TODO: force of multiline widget a better way
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
}
//}}}
} //}}}
@@ -846,7 +846,7 @@ function QuickMarks() //{{{
}
list += "";
- vimperator.commandline.echo(list, true); // TODO: force of multiline widget a better way
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
}
this.destroy = function()
diff --git a/content/buffers.js b/content/buffers.js
index 4d9a376c..c5835d68 100644
--- a/content/buffers.js
+++ b/content/buffers.js
@@ -253,7 +253,7 @@ function Buffer() //{{{
}
list += "";
- vimperator.commandline.echo(list, true);
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}
diff --git a/content/find.js b/content/find.js
index b8cfebf4..1ca6095d 100644
--- a/content/find.js
+++ b/content/find.js
@@ -161,9 +161,9 @@ function Search() //{{{
// our command line
setTimeout(function() {
if (up)
- vimperator.echoerr("search hit TOP, continuing at BOTTOM");
+ vimperator.commandline.echo("search hit TOP, continuing at BOTTOM", vimperator.commandline.HL_WARNING);
else
- vimperator.echoerr("search hit BOTTOM, continuing at TOP");
+ vimperator.commandline.echo("search hit BOTTOM, continuing at TOP", vimperator.commandline.HL_WARNING);
}, 0);
}
else
diff --git a/content/mappings.js b/content/mappings.js
index de1a51db..3ee53b90 100644
--- a/content/mappings.js
+++ b/content/mappings.js
@@ -296,7 +296,7 @@ function Mappings() //{{{
}
list += "";
- vimperator.commandline.echo(list, true); // TODO: force of multiline widget a better way
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
}
/////////////////////////////////////////////////////////////////////////////}}}
diff --git a/content/options.js b/content/options.js
index f68bc7fd..060a28f3 100644
--- a/content/options.js
+++ b/content/options.js
@@ -326,7 +326,7 @@ function Options() //{{{
list += "";
- vimperator.commandline.echo(list, true);
+ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
// TODO: separate Preferences from Options? Would these utility functions
diff --git a/content/ui.js b/content/ui.js
index cc8a7a48..6963196a 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -133,17 +133,9 @@ function CommandLine() //{{{
var multiline_regexp = null;
var multiline_callback = null;
- function setNormalStyle()
+ function setHighlightGroup(group)
{
- commandline_widget.setAttribute("class", "normal");
- }
- function setMessageStyle()
- {
- commandline_widget.setAttribute("class", "message");
- }
- function setErrorStyle()
- {
- commandline_widget.setAttribute("class", "error");
+ commandline_widget.setAttribute("class", group);
}
// Sets the prompt - for example, : or /
@@ -238,6 +230,13 @@ function CommandLine() //{{{
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
+ this.HL_NORMAL = "hl-Normal";
+ this.HL_ERRORMSG = "hl-ErrorMsg";
+ this.HL_MODEMSG = "hl-ModeMsg";
+ this.HL_MOREMSG = "hl-MoreMsg";
+ this.HL_QUESTION = "hl-Question";
+ this.HL_WARNING = "hl-Warning";
+
this.getCommand = function()
{
return command_widget.value;
@@ -251,7 +250,7 @@ function CommandLine() //{{{
cur_command = cmd || "";
cur_extended_mode = ext_mode || null;
- setNormalStyle();
+ setHighlightGroup(this.HL_NORMAL);
history_index = UNINITIALIZED;
completion_index = UNINITIALIZED;
@@ -276,7 +275,7 @@ function CommandLine() //{{{
}
// FIXME: flags not yet really functional --mst
- this.echo = function(str, flags)
+ this.echo = function(str, highlight_group, flags)
{
var focused = document.commandDispatcher.focusedElement;
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
@@ -285,7 +284,8 @@ function CommandLine() //{{{
if (typeof str != "string")
str = "";
- setNormalStyle();
+ highlight_group = highlight_group || this.HL_NORMAL;
+ setHighlightGroup(highlight_group);
if (flags || str.indexOf("\n") > -1 || str.indexOf("
") > -1 || str.indexOf("
") > -1)
{
setMultiline(str);
@@ -299,13 +299,14 @@ function CommandLine() //{{{
return true;
};
+ // FIXME: why is this duplicated? -- djk
this.echoErr = function(str)
{
var focused = document.commandDispatcher.focusedElement;
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
return false;
- setErrorStyle();
+ setHighlightGroup(this.HL_ERRORMSG);
setPrompt("");
setCommand(str);
cur_extended_mode = null;
@@ -318,7 +319,7 @@ function CommandLine() //{{{
{
// TODO: unfinished, need to find out how/if we can block the execution of code
// to make this code synchronous or at least use a callback
- setMessageStyle();
+ setHighlightGroup(this.HL_QUESTION);
setPrompt(str);
setCommand("");
return "not implemented";
@@ -352,9 +353,9 @@ function CommandLine() //{{{
multiline_output_widget.collapsed = true;
completionlist.hide();
+ setHighlightGroup(this.HL_NORMAL);
setPrompt(" "); // looks faster than an empty string as most prompts are 1 char long
setCommand("");
- setNormalStyle();
};
this.onEvent = function(event)
diff --git a/content/vimperator.js b/content/vimperator.js
index 920f10d2..f73c82a1 100644
--- a/content/vimperator.js
+++ b/content/vimperator.js
@@ -731,8 +731,8 @@ const vimperator = (function() //{{{
vimperator.hints = new Hints();
vimperator.log("All modules loaded", 3);
- vimperator.echo = vimperator.commandline.echo;
- vimperator.echoerr = vimperator.commandline.echoErr;
+ vimperator.echo = function(str) { vimperator.commandline.echo(str); }
+ vimperator.echoerr = function(str) { vimperator.commandline.echoErr(str); }
vimperator.globalVariables = {};
diff --git a/skin/vimperator.css b/skin/vimperator.css
index 4e88216d..3f7b9bc1 100644
--- a/skin/vimperator.css
+++ b/skin/vimperator.css
@@ -94,25 +94,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
}
#vimperator-commandline {
- /* FIXME: black on white or default skin colors? -moz-Field/-moz-FieldText */
+ padding: 1px;
+ /*
background-color: white;
color: black;
- padding: 1px;
+ */
}
#vimperator-commandline-prompt, #vimperator-commandline-command {
background-color: inherit;
color: inherit;
}
-#vimperator-commandline.error {
- background-color: red;
- color: white;
- font-weight: bold;
-}
-#vimperator-commandline.message > #vimperator-commandline-prompt {
- background-color: white;
- color: magenta;
- font-weight: bold;
-}
#vimperator-multiline-output {
overflow: hidden;
@@ -123,4 +114,35 @@ the terms of any one of the MPL, the GPL or the LGPL.
background-color: black;
}
+.hl-Normal {
+ background-color: white;
+ color: black;
+}
+.hl-ErrorMsg {
+ background-color: red;
+ color: white;
+ font-weight: bold;
+}
+.hl-ModeMsg {
+ background-color: white;
+ color: black;
+}
+.hl-MoreMsg {
+ background-color: white;
+ color: green;
+}
+.hl-Question {
+ background-color: white;
+ color: green;
+}
+.hl-Title {
+ background-color: white;
+ color: magenta;
+ font-weight: bold;
+}
+.hl-Warning {
+ background-color: white;
+ color: red;
+}
+
/* vim: set fdm=marker sw=4 ts=4 et: */