1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 21:17:58 +01:00

add more CSS classes for highlighting output messages and use hl-Warning (red

on white) for find related wrap messages
This commit is contained in:
Doug Kearns
2007-10-02 18:20:19 +00:00
parent 8d55e07c08
commit b76c20b99d
8 changed files with 62 additions and 39 deletions

View File

@@ -276,7 +276,7 @@ function Bookmarks() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}
}
@@ -499,7 +499,7 @@ function History() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}
}
@@ -755,7 +755,7 @@ function Marks() //{{{
}
list += "</table>";
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 += "</table>";
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()

View File

@@ -253,7 +253,7 @@ function Buffer() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
}

View File

@@ -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

View File

@@ -296,7 +296,7 @@ function Mappings() //{{{
}
list += "</table>";
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
}
/////////////////////////////////////////////////////////////////////////////}}}

View File

@@ -326,7 +326,7 @@ function Options() //{{{
list += "</table>";
vimperator.commandline.echo(list, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
}
// TODO: separate Preferences from Options? Would these utility functions

View File

@@ -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("<br>") > -1 || str.indexOf("<br/>") > -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)

View File

@@ -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 = {};

View File

@@ -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: */