mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 06:47: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:
@@ -276,7 +276,7 @@ function Bookmarks() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
list += "</table>";
|
||||||
|
|
||||||
vimperator.commandline.echo(list, true);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,7 +499,7 @@ function History() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
list += "</table>";
|
||||||
|
|
||||||
vimperator.commandline.echo(list, true);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -755,7 +755,7 @@ function Marks() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
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>";
|
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()
|
this.destroy = function()
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ function Buffer() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
list += "</table>";
|
||||||
|
|
||||||
vimperator.commandline.echo(list, true);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ function Search() //{{{
|
|||||||
// our command line
|
// our command line
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (up)
|
if (up)
|
||||||
vimperator.echoerr("search hit TOP, continuing at BOTTOM");
|
vimperator.commandline.echo("search hit TOP, continuing at BOTTOM", vimperator.commandline.HL_WARNING);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("search hit BOTTOM, continuing at TOP");
|
vimperator.commandline.echo("search hit BOTTOM, continuing at TOP", vimperator.commandline.HL_WARNING);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ function Mappings() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ function Options() //{{{
|
|||||||
|
|
||||||
list += "</table>";
|
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
|
// TODO: separate Preferences from Options? Would these utility functions
|
||||||
|
|||||||
@@ -133,17 +133,9 @@ function CommandLine() //{{{
|
|||||||
var multiline_regexp = null;
|
var multiline_regexp = null;
|
||||||
var multiline_callback = null;
|
var multiline_callback = null;
|
||||||
|
|
||||||
function setNormalStyle()
|
function setHighlightGroup(group)
|
||||||
{
|
{
|
||||||
commandline_widget.setAttribute("class", "normal");
|
commandline_widget.setAttribute("class", group);
|
||||||
}
|
|
||||||
function setMessageStyle()
|
|
||||||
{
|
|
||||||
commandline_widget.setAttribute("class", "message");
|
|
||||||
}
|
|
||||||
function setErrorStyle()
|
|
||||||
{
|
|
||||||
commandline_widget.setAttribute("class", "error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the prompt - for example, : or /
|
// Sets the prompt - for example, : or /
|
||||||
@@ -238,6 +230,13 @@ function CommandLine() //{{{
|
|||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// 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()
|
this.getCommand = function()
|
||||||
{
|
{
|
||||||
return command_widget.value;
|
return command_widget.value;
|
||||||
@@ -251,7 +250,7 @@ function CommandLine() //{{{
|
|||||||
cur_command = cmd || "";
|
cur_command = cmd || "";
|
||||||
cur_extended_mode = ext_mode || null;
|
cur_extended_mode = ext_mode || null;
|
||||||
|
|
||||||
setNormalStyle();
|
setHighlightGroup(this.HL_NORMAL);
|
||||||
history_index = UNINITIALIZED;
|
history_index = UNINITIALIZED;
|
||||||
completion_index = UNINITIALIZED;
|
completion_index = UNINITIALIZED;
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ function CommandLine() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: flags not yet really functional --mst
|
// FIXME: flags not yet really functional --mst
|
||||||
this.echo = function(str, flags)
|
this.echo = function(str, highlight_group, flags)
|
||||||
{
|
{
|
||||||
var focused = document.commandDispatcher.focusedElement;
|
var focused = document.commandDispatcher.focusedElement;
|
||||||
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
|
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
|
||||||
@@ -285,7 +284,8 @@ function CommandLine() //{{{
|
|||||||
if (typeof str != "string")
|
if (typeof str != "string")
|
||||||
str = "";
|
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)
|
if (flags || str.indexOf("\n") > -1 || str.indexOf("<br>") > -1 || str.indexOf("<br/>") > -1)
|
||||||
{
|
{
|
||||||
setMultiline(str);
|
setMultiline(str);
|
||||||
@@ -299,13 +299,14 @@ function CommandLine() //{{{
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: why is this duplicated? -- djk
|
||||||
this.echoErr = function(str)
|
this.echoErr = function(str)
|
||||||
{
|
{
|
||||||
var focused = document.commandDispatcher.focusedElement;
|
var focused = document.commandDispatcher.focusedElement;
|
||||||
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
|
if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setErrorStyle();
|
setHighlightGroup(this.HL_ERRORMSG);
|
||||||
setPrompt("");
|
setPrompt("");
|
||||||
setCommand(str);
|
setCommand(str);
|
||||||
cur_extended_mode = null;
|
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
|
// 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
|
// to make this code synchronous or at least use a callback
|
||||||
setMessageStyle();
|
setHighlightGroup(this.HL_QUESTION);
|
||||||
setPrompt(str);
|
setPrompt(str);
|
||||||
setCommand("");
|
setCommand("");
|
||||||
return "not implemented";
|
return "not implemented";
|
||||||
@@ -352,9 +353,9 @@ function CommandLine() //{{{
|
|||||||
multiline_output_widget.collapsed = true;
|
multiline_output_widget.collapsed = true;
|
||||||
completionlist.hide();
|
completionlist.hide();
|
||||||
|
|
||||||
|
setHighlightGroup(this.HL_NORMAL);
|
||||||
setPrompt(" "); // looks faster than an empty string as most prompts are 1 char long
|
setPrompt(" "); // looks faster than an empty string as most prompts are 1 char long
|
||||||
setCommand("");
|
setCommand("");
|
||||||
setNormalStyle();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onEvent = function(event)
|
this.onEvent = function(event)
|
||||||
|
|||||||
@@ -731,8 +731,8 @@ const vimperator = (function() //{{{
|
|||||||
vimperator.hints = new Hints();
|
vimperator.hints = new Hints();
|
||||||
vimperator.log("All modules loaded", 3);
|
vimperator.log("All modules loaded", 3);
|
||||||
|
|
||||||
vimperator.echo = vimperator.commandline.echo;
|
vimperator.echo = function(str) { vimperator.commandline.echo(str); }
|
||||||
vimperator.echoerr = vimperator.commandline.echoErr;
|
vimperator.echoerr = function(str) { vimperator.commandline.echoErr(str); }
|
||||||
|
|
||||||
vimperator.globalVariables = {};
|
vimperator.globalVariables = {};
|
||||||
|
|
||||||
|
|||||||
@@ -94,25 +94,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
}
|
}
|
||||||
|
|
||||||
#vimperator-commandline {
|
#vimperator-commandline {
|
||||||
/* FIXME: black on white or default skin colors? -moz-Field/-moz-FieldText */
|
padding: 1px;
|
||||||
|
/*
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 1px;
|
*/
|
||||||
}
|
}
|
||||||
#vimperator-commandline-prompt, #vimperator-commandline-command {
|
#vimperator-commandline-prompt, #vimperator-commandline-command {
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
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 {
|
#vimperator-multiline-output {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -123,4 +114,35 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
background-color: black;
|
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: */
|
/* vim: set fdm=marker sw=4 ts=4 et: */
|
||||||
|
|||||||
Reference in New Issue
Block a user