Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js

Issue 2269183003: DevTools: Merge CodeMirrorTextEditor's copyRange into text (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index 0e92a7281acb713f39c9b4dfd1bdeedb79ff76de..c1ee64ed3a67304ea6e7cc1b9c5c9b055a6fe839 100644
--- a/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -613,16 +613,6 @@ WebInspector.CodeMirrorTextEditor.prototype = {
},
/**
- * @param {!WebInspector.TextRange} textRange
- * @return {string}
- */
- copyRange: function(textRange)
- {
- var pos = WebInspector.CodeMirrorUtils.toPos(textRange.normalize());
- return this._codeMirror.getRange(pos.start, pos.end);
- },
-
- /**
* @return {boolean}
*/
isClean: function()
@@ -1157,11 +1147,15 @@ WebInspector.CodeMirrorTextEditor.prototype = {
},
/**
+ * @param {!WebInspector.TextRange=} textRange
* @return {string}
*/
- text: function()
+ text: function(textRange)
{
- return this._codeMirror.getValue().replace(/\n/g, this._lineSeparator);
+ if (!textRange)
+ return this._codeMirror.getValue().replace(/\n/g, this._lineSeparator);
+ var pos = WebInspector.CodeMirrorUtils.toPos(textRange.normalize());
+ return this._codeMirror.getRange(pos.start, pos.end).replace(/\n/g, this._lineSeparator);
},
/**
@@ -1435,7 +1429,7 @@ WebInspector.CodeMirrorTextEditor.SelectNextOccurrenceController.prototype = {
range = range.normalize();
var matchedLineNumber;
var matchedColumnNumber;
- var textToFind = this._textEditor.copyRange(range);
+ var textToFind = this._textEditor.text(range);
function findWordInLine(wordRegex, lineNumber, lineText, from, to)
{
if (typeof matchedLineNumber === "number")

Powered by Google App Engine
This is Rietveld 408576698