mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 19:47:58 +01:00
Fix pressing <Space> in content-editable windows. Closes issue #not-in-the-tracker-for-some-reason.
This commit is contained in:
@@ -221,7 +221,9 @@ var Buffer = Module("buffer", {
|
|||||||
*/
|
*/
|
||||||
get lastInputField() {
|
get lastInputField() {
|
||||||
let field = this.localStore.lastInputField && this.localStore.lastInputField.get();
|
let field = this.localStore.lastInputField && this.localStore.lastInputField.get();
|
||||||
return field && field.ownerDocument == field.ownerDocument.defaultView.document ? field : null;
|
let doc = field && field.ownerDocument;
|
||||||
|
let win = doc && doc.defaultView;
|
||||||
|
return win && doc === win.document ? field : null;
|
||||||
},
|
},
|
||||||
set lastInputField(value) { this.localStore.lastInputField = value && Cu.getWeakReference(value); },
|
set lastInputField(value) { this.localStore.lastInputField = value && Cu.getWeakReference(value); },
|
||||||
|
|
||||||
|
|||||||
@@ -1368,6 +1368,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
dactyl.echoerr(template.linkifyHelp(error.message));
|
dactyl.echoerr(template.linkifyHelp(error.message));
|
||||||
else
|
else
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
|
util.reportError(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (error.result == Cr.NS_BINDING_ABORTED)
|
if (error.result == Cr.NS_BINDING_ABORTED)
|
||||||
|
|||||||
@@ -375,19 +375,20 @@ var Editor = Module("editor", {
|
|||||||
* @see Abbreviation#expand
|
* @see Abbreviation#expand
|
||||||
*/
|
*/
|
||||||
expandAbbreviation: function (mode) {
|
expandAbbreviation: function (mode) {
|
||||||
let editor = Editor.getEditor();
|
let elem = dactyl.focusedElement;
|
||||||
if (!(editor && editor.value))
|
if (!(elem && elem.value))
|
||||||
return;
|
return;
|
||||||
let text = editor.value;
|
|
||||||
let start = editor.selectionStart;
|
let text = elem.value;
|
||||||
let end = editor.selectionEnd;
|
let start = elem.selectionStart;
|
||||||
|
let end = elem.selectionEnd;
|
||||||
let abbrev = abbreviations.match(mode, text.substring(0, start).replace(/.*\s/g, ""));
|
let abbrev = abbreviations.match(mode, text.substring(0, start).replace(/.*\s/g, ""));
|
||||||
if (abbrev) {
|
if (abbrev) {
|
||||||
let len = abbrev.lhs.length;
|
let len = abbrev.lhs.length;
|
||||||
let rhs = abbrev.expand(editor);
|
let rhs = abbrev.expand(elem);
|
||||||
editor.value = text.substring(0, start - len) + rhs + text.substring(start);
|
elem.value = text.substring(0, start - len) + rhs + text.substring(start);
|
||||||
editor.selectionStart = start - len + rhs.length;
|
elem.selectionStart = start - len + rhs.length;
|
||||||
editor.selectionEnd = end - len + rhs.length;
|
elem.selectionEnd = end - len + rhs.length;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -1277,7 +1277,8 @@ var Events = Module("events", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem instanceof HTMLTextAreaElement || (elem && util.computedStyle(elem).MozUserModify == "read-write")
|
if (elem instanceof HTMLTextAreaElement
|
||||||
|
|| elem instanceof Element && util.computedStyle(elem).MozUserModify === "read-write"
|
||||||
|| elem == null && win && Editor.getEditor(win)) {
|
|| elem == null && win && Editor.getEditor(win)) {
|
||||||
|
|
||||||
if (modes.main == modes.VISUAL && elem.selectionEnd == elem.selectionStart)
|
if (modes.main == modes.VISUAL && elem.selectionEnd == elem.selectionStart)
|
||||||
|
|||||||
@@ -574,6 +574,7 @@ var Styles = Module("Styles", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
bang: true,
|
||||||
completer: function (context, args) {
|
completer: function (context, args) {
|
||||||
let compl = [];
|
let compl = [];
|
||||||
let sheet = args["-group"].get(args["-name"]);
|
let sheet = args["-group"].get(args["-name"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user