diff --git a/common/content/commandline.js b/common/content/commandline.js index 0d7e4561..8611bb30 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1383,25 +1383,22 @@ var CommandLine = Module("commandline", { modes.addMode("COMMAND_LINE", { char: "c", description: "Active when the command line is focused", - input: true, + insert: true, ownsFocus: true, get mappingSelf() commandline.commandSession }); // this._extended modes, can include multiple modes, and even main modes modes.addMode("EX", { description: "Ex command mode, active when the command line is open for Ex commands", - bases: [modes.COMMAND_LINE], - input: true + bases: [modes.COMMAND_LINE] }); modes.addMode("PROMPT", { description: "Active when a prompt is open in the command line", - bases: [modes.COMMAND_LINE], - input: true + bases: [modes.COMMAND_LINE] }); modes.addMode("INPUT_MULTILINE", { - bases: [modes.INSERT], - input: true + bases: [modes.INSERT] }); }, mappings: function init_mappings() { diff --git a/common/content/editor.js b/common/content/editor.js index 8a692da9..15850b75 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -771,10 +771,7 @@ var Editor = Module("editor", { ["p"], "Paste clipboard contents", function ({ count }) { dactyl.assert(!editor.isCaret); - if (!count) - count = 1; - while (count--) - editor.executeCommand("cmd_paste", count); + editor.executeCommand("cmd_paste", count || 1); modes.pop(modes.TEXT_EDIT); }, { count: true }); diff --git a/common/content/events.js b/common/content/events.js index ac262d32..70a587a7 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -231,7 +231,7 @@ var KeyProcessor = Class("KeyProcessor", { } if (!this.waiting) - return this.main.input ? Events.PASS : Events.ABORT; + return this.main.insert ? Events.PASS : Events.ABORT; return Events.WAIT; } diff --git a/common/content/modes.js b/common/content/modes.js index 0c7aa62b..65523637 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -97,6 +97,7 @@ var Modes = Module("modes", { char: "t", description: "Vim-like editing of input elements", bases: [this.COMMAND], + input: true, ownsFocus: true, passUnknown: false }); @@ -109,12 +110,12 @@ var Modes = Module("modes", { char: "I", description: "The base mode for input modes, including Insert and Command Line", bases: [this.MAIN], - input: true + insert: true }); this.addMode("INSERT", { char: "i", description: "Active when an input element is focused", - input: true, + insert: true, ownsFocus: true }); this.addMode("AUTOCOMPLETE", { @@ -125,7 +126,7 @@ var Modes = Module("modes", { this.addMode("EMBED", { description: "Active when an or element is focused", - input: true, + insert: true, ownsFocus: true, passthrough: true }); @@ -134,7 +135,7 @@ var Modes = Module("modes", { description: "All keys but are ignored by " + config.appName, bases: [this.BASE], hidden: true, - input: true, + insert: true, passthrough: true }); this.addMode("QUOTE", { @@ -445,7 +446,7 @@ var Modes = Module("modes", { get bases() this.input ? [modes.INPUT] : [modes.MAIN], - get count() !this.input, + get count() !this.insert, get description() this._display, @@ -457,7 +458,9 @@ var Modes = Module("modes", { hidden: false, - input: Class.memoize(function input() this.bases.length && this.bases.some(function (b) b.input)), + input: Class.memoize(function input() this.insert || this.bases.length && this.bases.some(function (b) b.input)), + + insert: Class.memoize(function insert() this.bases.length && this.bases.some(function (b) b.insert)), ownsFocus: Class.memoize(function ownsFocus() this.bases.length && this.bases.some(function (b) b.ownsFocus)),