diff --git a/common/content/editor.js b/common/content/editor.js index 7533c3e1..3d858395 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -320,7 +320,7 @@ function Editor() //{{{ // FIXME: does not work correctly mappings.add([modes.INSERT], - [""], "Edit text field in vi mode", + [""], "Edit text field in Vi mode", function () { liberator.mode = modes.TEXTAREA; }); mappings.add([modes.INSERT], diff --git a/common/content/events.js b/common/content/events.js index f2898887..03ea0f81 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1314,7 +1314,7 @@ function Events() //{{{ if (elem instanceof HTMLTextAreaElement || (elem && elem.contentEditable == "true")) { if (options["insertmode"]) - modes.set(modes.INSERT, modes.TEXTAREA); + modes.set(modes.INSERT); else if (elem.selectionEnd - elem.selectionStart > 0) modes.set(modes.VISUAL, modes.TEXTAREA); else @@ -1374,6 +1374,7 @@ function Events() //{{{ { if (modes.passNextKey) return; + if (modes.passAllKeys) { modes.passAllKeys = false; @@ -1403,12 +1404,35 @@ function Events() //{{{ case modes.CARET: // setting this option will trigger an observer which will - // care about all other details like setting the NORMAL mode + // take care of all other details like setting the NORMAL + // mode options.setPref("accessibility.browsewithcaret", false); break; + case modes.TEXTAREA: + // TODO: different behaviour for text areas and other input + // fields seems unnecessarily complicated. If the user + // likes Vi-mode then they probably like it for all input + // fields, if not they can enter it explicitly for only + // text areas. The mode name TEXTAREA is confusing and + // would be better replaced with something indicating that + // it's a Vi editing mode. Extended modes really need to be + // displayed too. --djk + function isInputField() + { + let elem = liberator.focus; + return ((elem instanceof HTMLInputElement && !/image/.test(elem.type)) + || elem instanceof HTMLIsIndexElement); + } + + if (options["insertmode"] || isInputField()) + liberator.mode = modes.INSERT; + else + modes.reset(); + break; + case modes.INSERT: - if ((modes.extended & modes.TEXTAREA) && !options["insertmode"]) + if ((modes.extended & modes.TEXTAREA)) liberator.mode = modes.TEXTAREA; else modes.reset(); diff --git a/vimperator/TODO b/vimperator/TODO index c6bb418b..e83cdd62 100644 --- a/vimperator/TODO +++ b/vimperator/TODO @@ -38,6 +38,7 @@ BUGS: - The MOW shouldn't close when executing hints and ;F isn't working. FEATURES: +8 Document Textarea, Caret and Visual modes. 8 Incremental searches should retreat to their starting position on 8 Replace config.name tests in liberator with more specific feature tests or overridable APIs where at all feasible. diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 18639bb0..74bc5d56 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -494,10 +494,13 @@ ____ |\'noim'| |\'noinsertmode'| |\'im'| |\'insertmode'| + ||'insertmode' 'im'|| boolean (default: on) ____ -Use Insert mode as the default for text areas. -Makes Vimperator work in a way that Insert mode is the default mode for text areas. -Useful if you want to use Vimperator as a modeless editor, keeping the known Firefox interface for editing text areas. +Use Insert mode as the default for text areas. This is useful if you want to +use the known Firefox interface for editing text areas. Input fields default to +this behaviour irrespective of this option's setting. + +Textarea mode can be entered with ** from Insert mode. ____ +// TODO: is not hyperlinked as it's not documented yet. |\'ls'| |\'laststatus'| + diff --git a/xulmus/locale/en-US/options.txt b/xulmus/locale/en-US/options.txt index 2c7088fc..e937f225 100644 --- a/xulmus/locale/en-US/options.txt +++ b/xulmus/locale/en-US/options.txt @@ -483,10 +483,13 @@ ____ |\'noim'| |\'noinsertmode'| |\'im'| |\'insertmode'| + ||'insertmode' 'im'|| boolean (default: on) ____ -Use Insert mode as the default for text areas. -Makes Xulmus work in a way that Insert mode is the default mode for text areas. -Useful if you want to use Xulmus as a modeless editor, keeping the known Songbird interface for editing text areas. +Use Insert mode as the default for text areas. This is useful if you want to +use the known Firefox interface for editing text areas. Input fields default to +this behaviour irrespective of this option's setting. + +Textarea mode can be entered with ** from Insert mode. ____ +// TODO: is not hyperlinked as it's not documented yet. |\'ls'| |\'laststatus'| +