1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 19:35:45 +01:00

Preliminary REPL mode.

This commit is contained in:
Kris Maglione
2011-02-17 03:59:28 -05:00
parent caefc819bc
commit bd71135b08
11 changed files with 203 additions and 56 deletions

View File

@@ -31,6 +31,8 @@ var Editor = Module("editor", {
}
let elem = dactyl.focusedElement;
if (elem.inputField)
elem = elem.inputField;
if (elem.setSelectionRange) {
let text = dactyl.clipboardRead(clipboard);
@@ -49,7 +51,8 @@ var Editor = Module("editor", {
let value = elem.value.substring(0, start) + text + elem.value.substring(end);
elem.value = value;
Editor.getEditor(elem).rootElement.firstChild.textContent = value;
if (/^(search|text)$/.test(elem.type))
Editor.getEditor(elem).rootElement.firstChild.textContent = value;
elem.selectionStart = Math.min(start + (toStart ? 0 : text.length), elem.value.length);
elem.selectionEnd = elem.selectionStart;