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

add basic CSS highlighting to :hi, and fixed some small visual glitches

This commit is contained in:
Martin Stubenschrott
2008-11-01 14:35:08 +00:00
parent 2b3ef469c4
commit dd7178dfc6
2 changed files with 9 additions and 9 deletions

View File

@@ -19,11 +19,11 @@ function Highlights(name, store, serial)
String color: green; String color: green;
Normal color: black; background: white; Normal color: black; background: white;
ErrorMsg color: white; background: red; ErrorMsg color: white; background: red; font-weight: bold;
InfoMsg color: black; background: white; InfoMsg color: black; background: white;
ModeMsg color: black; background: white; ModeMsg color: black; background: white;
MoreMsg color: green; background: white; MoreMsg color: green; background: white;
WarningMsg color: red; background: white; WarningMsg color: red; background: white;
Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block; Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block;
Filter font-weight: bold; Filter font-weight: bold;
@@ -58,7 +58,7 @@ function Highlights(name, store, serial)
z-index: 5000; z-index: 5000;
font-family: monospace; font-family: monospace;
font-size: 10px; font-size: 10px;
font-weight: bold; font-weight: bold;
color: white; color: white;
background-color: red; background-color: red;
border-color: ButtonShadow; border-color: ButtonShadow;
@@ -478,8 +478,6 @@ liberator.registerObserver("load_commands", function ()
; ;
display: inline-block !important; display: inline-block !important;
position: static !important; position: static !important;
width: 3em !important; min-width: 3em !important; max-width: 3em !important;
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
margin: 0px !important; padding: 0px !important; margin: 0px !important; padding: 0px !important;
overflow: hidden !important; overflow: hidden !important;
]]>; ]]>;
@@ -490,10 +488,11 @@ liberator.registerObserver("load_commands", function ()
let str = template.tabular(["Key", "Sample", "CSS"], let str = template.tabular(["Key", "Sample", "CSS"],
["padding: 0 1em 0 0; vertical-align: top"], ["padding: 0 1em 0 0; vertical-align: top"],
([h.class, ([h.class,
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>, <span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
h.value] template.maybeXML(h.value.replace(/\s+/g, "\u00a0")
.replace(/\b([-\w]+):/g, "<span class=\"hl-Filter\">$1:</span>"))]
for (h in highlight) for (h in highlight)
if (!key || h.class.indexOf(key) > -1))); if (!key || h.class.indexOf(key) > -1)));
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE); commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
return; return;
} }

View File

@@ -81,6 +81,7 @@ const template = {
return str; return str;
if (str == "") if (str == "")
return <>{str}</>; return <>{str}</>;
let lcstr = String(str).toLowerCase(); let lcstr = String(str).toLowerCase();
let lcfilter = filter.toLowerCase(); let lcfilter = filter.toLowerCase();
str = String(str).replace(" ", "\u00a0"); str = String(str).replace(" ", "\u00a0");
@@ -89,7 +90,7 @@ const template = {
let i; let i;
while ((i = lcstr.indexOf(lcfilter, start)) > -1) while ((i = lcstr.indexOf(lcfilter, start)) > -1)
{ {
XML.ignoreWhitespace = false; XML.ignoreWhitespace = false;
s += <>{str.substring(start, i)}</>; s += <>{str.substring(start, i)}</>;
s += <span class="hl-Filter">{str.substr(i, filter.length)}</span>; s += <span class="hl-Filter">{str.substr(i, filter.length)}</span>;
start = i + filter.length; start = i + filter.length;