From 3604513a60e4dee8911095a1978710880cdf9ee4 Mon Sep 17 00:00:00 2001 From: Robert Krahn Date: Mon, 18 Feb 2013 23:38:44 -0800 Subject: [PATCH] fixing onPaste in command with multiselect --- lib/ace/multi_select.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/ace/multi_select.js b/lib/ace/multi_select.js index f3baef79..fb32dd56 100644 --- a/lib/ace/multi_select.js +++ b/lib/ace/multi_select.js @@ -523,14 +523,18 @@ var Editor = require("./editor").Editor; return; this._emit("paste", text); - if (!this.inMultiSelectMode) - return this.insert(text); + if (!this.inMultiSelectMode || this.inVirtualSelectionMode) { + this.insert(text); + return; + } - var lines = text.split(/\r\n|\r|\n/); - var ranges = this.selection.rangeList.ranges; + var lines = text.split(/\r\n|\r|\n/), + ranges = this.selection.rangeList.ranges; - if (lines.length > ranges.length || (lines.length <= 2 || !lines[1])) - return this.commands.exec("insertstring", this, text); + if (lines.length > ranges.length || (lines.length <= 2 || !lines[1])) { + this.commands.exec("insertstring", this, text); + return; + } for (var i = ranges.length; i--; ) { var range = ranges[i];