Changeset 83983 in webkit
- Timestamp:
- Apr 15, 2011 9:29:38 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r83981 r83983 1 2011-04-15 Andrey Adaikin <aandrey@google.com> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n as line separators 6 https://bugs.webkit.org/show_bug.cgi?id=58449 7 8 * inspector/editor/text-editor-model-expected.txt: Added. 9 * inspector/editor/text-editor-model.html: Added. 10 1 11 2011-04-15 Eric Seidel <eric@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r83975 r83983 1 2011-04-15 Andrey Adaikin <aandrey@google.com> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n as line separators 6 https://bugs.webkit.org/show_bug.cgi?id=58449 7 8 Test: inspector/editor/text-editor-model.html 9 10 * inspector/front-end/TextEditorModel.js: 11 (WebInspector.TextEditorModel): 12 (WebInspector.TextEditorModel.prototype.get text): 13 (WebInspector.TextEditorModel.prototype.setText): 14 (WebInspector.TextEditorModel.prototype._innerSetText): 15 (WebInspector.TextEditorModel.prototype.copyRange): 16 1 17 2011-04-15 Sergey Vorobyev <sergeyvorobyev@google.com> 2 18 -
trunk/Source/WebCore/inspector/front-end/TextEditorModel.js
r83725 r83983 60 60 this._undoStack = []; 61 61 this._noPunctuationRegex = /[^ !%&()*+,-.:;<=>?\[\]\^{|}~]+/; 62 this._lineBreak = "\n"; 62 63 } 63 64 … … 75 76 get text() 76 77 { 77 return this._lines.join( "\n");78 return this._lines.join(this._lineBreak); 78 79 }, 79 80 … … 92 93 setText: function(range, text) 93 94 { 94 if (!range) 95 if (!range) { 95 96 range = new WebInspector.TextRange(0, 0, this._lines.length - 1, this._lines[this._lines.length - 1].length); 97 this._lineBreak = /\r\n/.test(text) ? "\r\n" : "\n"; 98 } 96 99 var command = this._pushUndoableCommand(range); 97 100 var newRange = this._innerSetText(range, text); … … 114 117 return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn); 115 118 116 var newLines = text.split( "\n");119 var newLines = text.split(/\r?\n/); 117 120 this._replaceTabsIfNeeded(newLines); 118 121 … … 211 214 if (range.startLine === range.endLine) { 212 215 clip.push(this._lines[range.startLine].substring(range.startColumn, range.endColumn)); 213 return clip.join( "\n");216 return clip.join(this._lineBreak); 214 217 } 215 218 clip.push(this._lines[range.startLine].substring(range.startColumn)); … … 217 220 clip.push(this._lines[i]); 218 221 clip.push(this._lines[range.endLine].substring(0, range.endColumn)); 219 return clip.join( "\n");222 return clip.join(this._lineBreak); 220 223 }, 221 224
Note: See TracChangeset
for help on using the changeset viewer.