diff --git a/binary/config.mk b/binary/config.mk index de675d25..8b3b64cd 100644 --- a/binary/config.mk +++ b/binary/config.mk @@ -15,7 +15,8 @@ SED := $(shell if [ "xoo" = x$$(echo foo | sed -E 's/f(o)/\1/' 2>/dev/null) ]; \ PKGCONFIG ?= pkg-config GECKO_SDK_PATH := $(shell $(PKGCONFIG) --libs libxul | $(SED) 's,([^-]|-[^L])*-L([^ ]+)/lib.*,\2,') -CXX ?= c++ -o +CXX ?= c++ +CPP = $(CXX) -o LINK ?= c++ MKDEP ?= $(CXX) -M diff --git a/binary/install.rdf b/binary/install.rdf index 77b40589..1014f472 100644 --- a/binary/install.rdf +++ b/binary/install.rdf @@ -9,6 +9,13 @@ em:description="Binary utilities for dactyl add-ons" em:unpack="true"> + + + + .depend diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 0eec5c00..be494453 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -796,7 +796,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }; } else if (obj instanceof Option) { - tag = spec = function (name) <>'{name}'; + spec = function () template.map(obj.names, tag, " "); + tag = function (name) <>'{name}'; link = function (opt, name) {name}; args = { value: "", values: [] }; } @@ -819,9 +820,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { res.* += <> {template.map(obj.names.slice().reverse(), tag, " ")} - {(obj instanceof Option) - ? template.map(obj.names.slice(), spec, " ") - : let (name = (obj.specs || obj.names)[0]) + {let (name = (obj.specs || obj.names)[0]) spec(template.highlightRegexp(tag(name), /\[(.*?)\]/g, function (m, n0) {n0}), diff --git a/common/content/editor.js b/common/content/editor.js index 1ae532bd..3875e450 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -204,17 +204,33 @@ var Editor = Module("editor", { if (textBox) { var text = textBox.value; - let pre = text.substr(0, textBox.selectionStart); - line = 1 + pre.replace(/[^\n]/g, "").length; - column = 1 + pre.replace(/[^]*\n/, "").length; + var pre = text.substr(0, textBox.selectionStart); } else { var editor_ = window.GetCurrentEditor ? GetCurrentEditor() : Editor.getEditor(document.commandDispatcher.focusedWindow); dactyl.assert(editor_); text = Array.map(editor_.rootElement.childNodes, function (e) DOM.stringify(e, true)).join(""); + + util.dump(editor_.selection); + + if (!editor_.selection.rangeCount) + var sel = ""; + else { + let range = RangeFind.nodeContents(editor_.rootElement); + let end = editor_.selection.getRangeAt(0); + range.setEnd(end.startContainer, end.startOffset); + pre = DOM.stringify(range, true); + if (range.startContainer instanceof Text) + pre = pre.replace(/^(?:<[^>"]+>)+/, ""); + if (range.endContainer instanceof Text) + pre = pre.replace(/(?:<\/[^>"]+>)+$/, ""); + } } + line = 1 + pre.replace(/[^\n]/g, "").length; + column = 1 + pre.replace(/[^]*\n/, "").length; + let origGroup = textBox && textBox.getAttributeNS(NS, "highlight") || ""; let cleanup = util.yieldable(function cleanup(error) { if (timer)