1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 07:52:27 +01:00

Push INSERT mode on top of PASS THROUGH mode when entering an input field, rather than clearing the mode stack.

This commit is contained in:
Kris Maglione
2010-11-17 19:18:19 -05:00
parent 7abe83ed8d
commit 5a618bee0e
5 changed files with 34 additions and 18 deletions

View File

@@ -718,7 +718,9 @@ const Events = Module("events", {
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
elem instanceof HTMLSelectElement ||
elem instanceof Window && Editor.getEditor(elem)) {
dactyl.mode = modes.INSERT;
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
modes.push(modes.INSERT);
if (hasHTMLDocument(win))
buffer.lastInputField = elem;
return;
@@ -735,13 +737,14 @@ const Events = Module("events", {
if (modes.main === modes.VISUAL && elem.selectionEnd == elem.selectionStart)
modes.pop();
if (options["insertmode"])
modes.set(modes.INSERT);
else {
modes.set(modes.TEXT_EDIT);
if (elem.selectionEnd - elem.selectionStart > 0)
modes.push(modes.VISUAL);
}
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
if (options["insertmode"])
modes.push(modes.INSERT);
else {
modes.push(modes.TEXT_EDIT);
if (elem.selectionEnd - elem.selectionStart > 0)
modes.push(modes.VISUAL);
}
if (hasHTMLDocument(win))
buffer.lastInputField = elem;