diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 178b11f5..0b871417 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -739,25 +739,24 @@ var Editor = function(renderer, session) { this.renderer.updateFull(); }; + + /** + * Returns the string of text currently highlighted. + * @returns {String} + **/ + this.getSelectedText = function() { + return this.session.getTextRange(this.getSelectionRange()); + }; + /** * Emitted when text is copied. * @event copy * @param {String} text The copied text * - * **/ - /** - * - * Returns the string of text currently highlighted. - * @returns {String} - **/ - this.getCopyText = function() { - var text = ""; - if (!this.selection.isEmpty()) - text = this.session.getTextRange(this.getSelectionRange()); - - this._emit("copy", text); + var text = this.getSelectedText(); + this._signal("copy", text); return text; }; diff --git a/lib/ace/multi_select.js b/lib/ace/multi_select.js index d571b6dd..324b1982 100644 --- a/lib/ace/multi_select.js +++ b/lib/ace/multi_select.js @@ -519,7 +519,7 @@ var Editor = require("./editor").Editor; this.multiSelect.toSingleRange(); }; - this.getCopyText = function() { + this.getSelectedText = function() { var text = ""; if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { var ranges = this.multiSelect.rangeList.ranges; @@ -534,7 +534,6 @@ var Editor = require("./editor").Editor; } else if (!this.selection.isEmpty()) { text = this.session.getTextRange(this.getSelectionRange()); } - this._signal("copy", text); return text; };