Commit d02e5bb7 authored by einbinder's avatar einbinder Committed by Commit bot

DevTools: Let CodeMirror handle line endings

CodeMirror takes a line seperator as an argument, so we don't have to
use a regular expression.

BUG=none

Review-Url: https://codereview.chromium.org/2615633012
Cr-Commit-Position: refs/heads/master@{#442079}
parent f08e3096
...@@ -1189,9 +1189,9 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox { ...@@ -1189,9 +1189,9 @@ TextEditor.CodeMirrorTextEditor = class extends UI.VBox {
*/ */
text(textRange) { text(textRange) {
if (!textRange) if (!textRange)
return this._codeMirror.getValue().replace(/\n/g, this._lineSeparator); return this._codeMirror.getValue(this._lineSeparator);
var pos = TextEditor.CodeMirrorUtils.toPos(textRange.normalize()); var pos = TextEditor.CodeMirrorUtils.toPos(textRange.normalize());
return this._codeMirror.getRange(pos.start, pos.end).replace(/\n/g, this._lineSeparator); return this._codeMirror.getRange(pos.start, pos.end, this._lineSeparator);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment