1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:52:26 +01:00

Move bindings.xmlbindings.xmltab back to regular bindings file. Adjust completion arrow layout. Reload highlight data on new window.

This commit is contained in:
Kris Maglione
2008-11-29 23:34:15 +00:00
parent 50e610e63d
commit 4a0fb1e3c7
6 changed files with 145 additions and 147 deletions

View File

@@ -1,10 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<bindings xmlns="http://www.mozilla.org/xbl" <bindings xmlns="http://www.mozilla.org/xbl"
xmlns:liberator="http://vimperator.org/namespaces/liberator" xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@@ -21,6 +16,22 @@
<!-- No white space. The table is white-space: pre; :( --> <!-- No white space. The table is white-space: pre; :( -->
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content> <content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>
</binding> </binding>
<binding id="tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab">
<content chromedir="ltr" closetabtext="Close Tab">
<xul:stack class="liberator-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" liberator:highlight="TabIcon"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabNumber"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" liberator:highlight="TabText"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" liberator:highlight="TabClose"/>
</content>
</binding>
</bindings> </bindings>
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: --> <!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->

View File

@@ -1405,6 +1405,8 @@ function Completion() //{{{
{ {
let opt = options.get(name); let opt = options.get(name);
let completer = opt.completer; let completer = opt.completer;
if (!completer)
return;
let curValues = curValue != null ? opt.parseValues(curValue) : opt.values; let curValues = curValue != null ? opt.parseValues(curValue) : opt.values;
let newValues = opt.parseValues(context.filter); let newValues = opt.parseValues(context.filter);

View File

@@ -6,9 +6,7 @@
it under any or all of those licenseses. it under any or all of those licenseses.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Highlights(name, store, serial) Highlights.prototype.CSS = <![CDATA[
{
const highlightCSS = <![CDATA[
Boolean color: red; Boolean color: red;
Function color: navy; Function color: navy;
Null color: blue; Null color: blue;
@@ -38,9 +36,9 @@ function Highlights(name, store, serial)
CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle; CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle;
CompResult width: 45%; overflow: hidden; CompResult width: 45%; overflow: hidden;
CompDesc color: gray; width: 50%; CompDesc color: gray; width: 50%;
CompLess text-align: center; height: .5ex; line-height: .5ex; padding-top: 1ex; CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex;
CompLess::after content: "\2303" /* Unicode up arrowhead */ CompLess::after content: "\2303" /* Unicode up arrowhead */
CompMore text-align: center; height: .5ex; line-height: .5ex; CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex;
CompMore::after content: "\2304" /* Unicode down arrowhead */ CompMore::after content: "\2304" /* Unicode down arrowhead */
Gradient height: 1px; margin-bottom: -1px; margin-top: -1px; Gradient height: 1px; margin-bottom: -1px; margin-top: -1px;
@@ -111,6 +109,8 @@ function Highlights(name, store, serial)
padding: 0; padding: 0;
} }
]]>.toString(); ]]>.toString();
function Highlights(name, store, serial)
{
var self = this; var self = this;
var highlight = {}; var highlight = {};
var styles = storage.styles; var styles = storage.styles;
@@ -144,6 +144,7 @@ function Highlights(name, store, serial)
if (style.default == null) if (style.default == null)
{ {
delete highlight[style.class]; delete highlight[style.class];
styles.removeSheet(style.selector, null, null, null, true);
return null; return null;
} }
newStyle = style.default; newStyle = style.default;
@@ -167,14 +168,24 @@ function Highlights(name, store, serial)
return "[liberator|highlight~=" + hl + "]" + rest return "[liberator|highlight~=" + hl + "]" + rest
}; };
highlightCSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " ")) this.reload = function ()
{
this.CSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " "))
.split("\n").filter(function (s) /\S/.test(s)) .split("\n").filter(function (s) /\S/.test(s))
.forEach(function (style) .forEach(function (style)
{ {
style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1)); style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1));
let old = highlight[style.class];
highlight[style.class] = style; highlight[style.class] = style;
self.set(style.class); if (old && old.value != old.default)
style.value = old.value;
}); });
for (let [class, hl] in Iterator(highlight))
{
if (hl.value == hl.default)
this.set(class);
}
}
} }
function Styles(name, store, serial) function Styles(name, store, serial)
@@ -402,6 +413,8 @@ let (array = util.Array)
const styles = storage.newObject("styles", Styles, false); const styles = storage.newObject("styles", Styles, false);
const highlight = storage.newObject("highlight", Highlights, false); const highlight = storage.newObject("highlight", Highlights, false);
highlight.CSS = Highlights.prototype.CSS;
highlight.reload();
liberator.registerObserver("load_commands", function () liberator.registerObserver("load_commands", function ()
{ {

View File

@@ -220,8 +220,8 @@ function Tabs() //{{{
validator: options.validateCompleter validator: options.validateCompleter
}); });
// TODO: Add option, or only apply when go~=[nN] // TODO: Add option, or only apply when go~=[nN]
styles.addSheet("tab-binding", "chrome://*", styles.addSheet("tab-binding", "chrome://browser/content/browser.xul",
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/vimperator/bindings.xml#tab) !important; }", true); ".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/bindings.xml#tab) !important; }", true);
} }

View File

@@ -1418,9 +1418,11 @@ function ItemList(id) //{{{
let haveCompletions = false; let haveCompletions = false;
let off = 0; let off = 0;
let end = endIndex;
function getRows(context) function getRows(context)
{ {
function fix(n) Math.max(0, Math.min(len, n)); function fix(n) Math.max(0, Math.min(len, n));
end -= context.message + context.incomplete;
let len = context.items.length; let len = context.items.length;
let start = off; let start = off;
off += len; off += len;

View File

@@ -1,30 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab">
<content chromedir="ltr" closetabtext="Close Tab">
<xul:stack class="liberator-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" liberator:highlight="TabIcon"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabNumber"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" liberator:highlight="TabText"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" liberator:highlight="TabClose"/>
</content>
</binding>
</bindings>