Changeset 83983 in webkit


Ignore:
Timestamp:
Apr 15, 2011 9:29:38 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-15 Andrey Adaikin <aandrey@google.com>

Reviewed by Pavel Feldman.

Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n as line separators
https://bugs.webkit.org/show_bug.cgi?id=58449

  • inspector/editor/text-editor-model-expected.txt: Added.
  • inspector/editor/text-editor-model.html: Added.

2011-04-15 Andrey Adaikin <aandrey@google.com>

Reviewed by Pavel Feldman.

Web Inspector: TextViewer and TextEditorModel must support both \n and \r\n as line separators
https://bugs.webkit.org/show_bug.cgi?id=58449

Test: inspector/editor/text-editor-model.html

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83981 r83983  
     12011-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
    1112011-04-15  Eric Seidel  <eric@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r83975 r83983  
     12011-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
    1172011-04-15  Sergey Vorobyev  <sergeyvorobyev@google.com>
    218
  • trunk/Source/WebCore/inspector/front-end/TextEditorModel.js

    r83725 r83983  
    6060    this._undoStack = [];
    6161    this._noPunctuationRegex = /[^ !%&()*+,-.:;<=>?\[\]\^{|}~]+/;
     62    this._lineBreak = "\n";
    6263}
    6364
     
    7576    get text()
    7677    {
    77         return this._lines.join("\n");
     78        return this._lines.join(this._lineBreak);
    7879    },
    7980
     
    9293    setText: function(range, text)
    9394    {
    94         if (!range)
     95        if (!range) {
    9596            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        }
    9699        var command = this._pushUndoableCommand(range);
    97100        var newRange = this._innerSetText(range, text);
     
    114117            return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
    115118
    116         var newLines = text.split("\n");
     119        var newLines = text.split(/\r?\n/);
    117120        this._replaceTabsIfNeeded(newLines);
    118121
     
    211214        if (range.startLine === range.endLine) {
    212215            clip.push(this._lines[range.startLine].substring(range.startColumn, range.endColumn));
    213             return clip.join("\n");
     216            return clip.join(this._lineBreak);
    214217        }
    215218        clip.push(this._lines[range.startLine].substring(range.startColumn));
     
    217220            clip.push(this._lines[i]);
    218221        clip.push(this._lines[range.endLine].substring(0, range.endColumn));
    219         return clip.join("\n");
     222        return clip.join(this._lineBreak);
    220223    },
    221224
Note: See TracChangeset for help on using the changeset viewer.