diff --git a/content/bindings.xml b/content/bindings.xml index 6d9ecb2b..8d6474d0 100644 --- a/content/bindings.xml +++ b/content/bindings.xml @@ -1,10 +1,5 @@ - -%globalDTD; -]> - + + + + + + + + + + + + + + + diff --git a/content/completion.js b/content/completion.js index 89a0486a..ced5f0cd 100644 --- a/content/completion.js +++ b/content/completion.js @@ -1405,6 +1405,8 @@ function Completion() //{{{ { let opt = options.get(name); let completer = opt.completer; + if (!completer) + return; let curValues = curValue != null ? opt.parseValues(curValue) : opt.values; let newValues = opt.parseValues(context.filter); diff --git a/content/style.js b/content/style.js index 3adce64f..f153a4b1 100644 --- a/content/style.js +++ b/content/style.js @@ -6,111 +6,111 @@ it under any or all of those licenseses. }}} ***** END LICENSE BLOCK *****/ +Highlights.prototype.CSS = * /* border-bottom: 1px dashed magenta; */ + CompMsg font-style: italic; margin-left: 16px; + CompItem + CompItem[selected] background: yellow; + CompItem>* padding: 0 .5ex; + CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex; + CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle; + CompResult width: 45%; overflow: hidden; + CompDesc color: gray; width: 50%; + CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex; + CompLess::after content: "\2303" /* Unicode up arrowhead */ + CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex; + CompMore::after content: "\2304" /* Unicode down arrowhead */ + + Gradient height: 1px; margin-bottom: -1px; margin-top: -1px; + GradientLeft background-color: magenta; + GradientRight background-color: white; + + Indicator color: blue; + Filter font-weight: bold; + + Keyword color: red; + Tag color: blue; + + LineNr color: orange; background: white; + Question color: green; background: white; font-weight: bold; + + StatusLine color: white; background: black; + StatusLineBroken color: black; background: #FF6060; /* light-red */ + StatusLineSecure color: black; background: #B0FF00; /* light-green */ + + TabClose + TabIcon + TabText + TabNumber font-weight: bold; margin: 0px; padding-right: .3ex; + TabIconNumber { + font-weight: bold; + color: white; + text-align: center; + text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px; + } + + Title color: magenta; background: white; font-weight: bold; + URL text-decoration: none; color: green; background: inherit; + URL:hover text-decoration: underline; cursor: pointer; + + FrameIndicator,,* { + background-color: red; + opacity: 0.5; + z-index: 999; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + Bell border: none; background-color: black; + Hint,,* { + font-family: monospace; + font-size: 10px; + font-weight: bold; + color: white; + background-color: red; + border-color: ButtonShadow; + border-width: 0px; + border-style: solid; + padding: 0px 1px 0px 1px; + } + Hint::after,,* content: attr(number); + HintElem,,* background-color: yellow; color: black; + HintActive,,* background-color: #88FF00; color: black; + HintImage,,* opacity: .5; + + Search,,* { + font-size: inherit; + padding: 0; + color: black; + background-color: yellow; + padding: 0; + } + ]]>.toString(); function Highlights(name, store, serial) { - const highlightCSS = * /* border-bottom: 1px dashed magenta; */ - CompMsg font-style: italic; margin-left: 16px; - CompItem - CompItem[selected] background: yellow; - CompItem>* padding: 0 .5ex; - CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex; - CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle; - CompResult width: 45%; overflow: hidden; - CompDesc color: gray; width: 50%; - CompLess text-align: center; height: .5ex; line-height: .5ex; padding-top: 1ex; - CompLess::after content: "\2303" /* Unicode up arrowhead */ - CompMore text-align: center; height: .5ex; line-height: .5ex; - CompMore::after content: "\2304" /* Unicode down arrowhead */ - - Gradient height: 1px; margin-bottom: -1px; margin-top: -1px; - GradientLeft background-color: magenta; - GradientRight background-color: white; - - Indicator color: blue; - Filter font-weight: bold; - - Keyword color: red; - Tag color: blue; - - LineNr color: orange; background: white; - Question color: green; background: white; font-weight: bold; - - StatusLine color: white; background: black; - StatusLineBroken color: black; background: #FF6060; /* light-red */ - StatusLineSecure color: black; background: #B0FF00; /* light-green */ - - TabClose - TabIcon - TabText - TabNumber font-weight: bold; margin: 0px; padding-right: .3ex; - TabIconNumber { - font-weight: bold; - color: white; - text-align: center; - text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px; - } - - Title color: magenta; background: white; font-weight: bold; - URL text-decoration: none; color: green; background: inherit; - URL:hover text-decoration: underline; cursor: pointer; - - FrameIndicator,,* { - background-color: red; - opacity: 0.5; - z-index: 999; - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - } - - Bell border: none; background-color: black; - Hint,,* { - font-family: monospace; - font-size: 10px; - font-weight: bold; - color: white; - background-color: red; - border-color: ButtonShadow; - border-width: 0px; - border-style: solid; - padding: 0px 1px 0px 1px; - } - Hint::after,,* content: attr(number); - HintElem,,* background-color: yellow; color: black; - HintActive,,* background-color: #88FF00; color: black; - HintImage,,* opacity: .5; - - Search,,* { - font-size: inherit; - padding: 0; - color: black; - background-color: yellow; - padding: 0; - } - ]]>.toString(); var self = this; var highlight = {}; var styles = storage.styles; @@ -144,6 +144,7 @@ function Highlights(name, store, serial) if (style.default == null) { delete highlight[style.class]; + styles.removeSheet(style.selector, null, null, null, true); return null; } newStyle = style.default; @@ -167,14 +168,24 @@ function Highlights(name, store, serial) return "[liberator|highlight~=" + hl + "]" + rest }; - highlightCSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " ")) - .split("\n").filter(function (s) /\S/.test(s)) - .forEach(function (style) + this.reload = function () { - style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1)); - highlight[style.class] = style; - self.set(style.class); - }); + this.CSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " ")) + .split("\n").filter(function (s) /\S/.test(s)) + .forEach(function (style) + { + style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1)); + let old = highlight[style.class]; + highlight[style.class] = style; + 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) @@ -402,6 +413,8 @@ let (array = util.Array) const styles = storage.newObject("styles", Styles, false); const highlight = storage.newObject("highlight", Highlights, false); +highlight.CSS = Highlights.prototype.CSS; +highlight.reload(); liberator.registerObserver("load_commands", function () { diff --git a/content/tabs.js b/content/tabs.js index 25f4c942..1bfd1b4e 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -220,8 +220,8 @@ function Tabs() //{{{ validator: options.validateCompleter }); // TODO: Add option, or only apply when go~=[nN] - styles.addSheet("tab-binding", "chrome://*", - ".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/vimperator/bindings.xml#tab) !important; }", true); + styles.addSheet("tab-binding", "chrome://browser/content/browser.xul", + ".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/bindings.xml#tab) !important; }", true); } diff --git a/content/ui.js b/content/ui.js index 2e02aa2e..b5c81a39 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1418,9 +1418,11 @@ function ItemList(id) //{{{ let haveCompletions = false; let off = 0; + let end = endIndex; function getRows(context) { function fix(n) Math.max(0, Math.min(len, n)); + end -= context.message + context.incomplete; let len = context.items.length; let start = off; off += len; diff --git a/content/vimperator/bindings.xml b/content/vimperator/bindings.xml deleted file mode 100644 index c75544aa..00000000 --- a/content/vimperator/bindings.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - -%globalDTD; -]> - - - - - - - - - - - - - - - - - - -