Changeset 233920 in webkit


Ignore:
Timestamp:
Jul 18, 2018 11:40:14 AM (6 years ago)
Author:
Matt Baker
Message:

Web Inspector: REGRESSION(r232591): CodeMirrorEditor should not use a RegExp lineSeparator option
https://bugs.webkit.org/show_bug.cgi?id=187772
<rdar://problem/42331640>

Reviewed by Joseph Pecoraro.

  • UserInterface/Views/CodeMirrorEditor.js:

(WI.CodeMirrorEditor.create):
(WI.CodeMirrorEditor):
CodeMirror should be left to auto-detect line separators. By default
it detects \n, \r\n, and \r. By specifying a regular expression we
merely cause problems when CodeMirror uses the supplied lineSeparator
when joining its array of lines together.

  • UserInterface/Views/TextEditor.js:

(WI.TextEditor.set string.update):
(WI.TextEditor.prototype.set string):
This assertion was only true when we forced "\n" line endings everywhere.
It no longer holds for source text with "\r\n" (Windows-style) line endings.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r233861 r233920  
     12018-07-18  Matt Baker  <mattbaker@apple.com>
     2
     3        Web Inspector: REGRESSION(r232591): CodeMirrorEditor should not use a RegExp lineSeparator option
     4        https://bugs.webkit.org/show_bug.cgi?id=187772
     5        <rdar://problem/42331640>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/Views/CodeMirrorEditor.js:
     10        (WI.CodeMirrorEditor.create):
     11        (WI.CodeMirrorEditor):
     12        CodeMirror should be left to auto-detect line separators. By default
     13        it detects \n, \r\n, and \r. By specifying a regular expression we
     14        merely cause problems when CodeMirror uses the supplied lineSeparator
     15        when joining its array of lines together.
     16
     17        * UserInterface/Views/TextEditor.js:
     18        (WI.TextEditor.set string.update):
     19        (WI.TextEditor.prototype.set string):
     20        This assertion was only true when we forced "\n" line endings everywhere.
     21        It no longer holds for source text with "\r\n" (Windows-style) line endings.
     22
    1232018-07-16  Matt Baker  <mattbaker@apple.com>
    224
  • trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js

    r233824 r233920  
    2828    static create(element, options)
    2929    {
    30         // Default line endings match typical expected line endings for JavaScript (at least those supported by JavaScriptCore).
    31         if (options.lineSeparator === undefined)
    32             options.lineSeparator = /\r\n?|\n/;
    33 
    3430        // CodeMirror's manual scrollbar positioning results in double scrollbars,
    3531        // nor does it handle braces and brackets well, so default to using LTR.
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js

    r233861 r233920  
    119119                this._codeMirror.removeLineClass(0, "wrap");
    120120
    121             if (this._codeMirror.getValue() !== newString) {
     121            if (this._codeMirror.getValue() !== newString)
    122122                this._codeMirror.setValue(newString);
    123                 console.assert(this.string.length === newString.length, "A lot of our code depends on precise text offsets, so the string should remain the same.");
    124             } else {
     123            else {
    125124                // Ensure we at display content even if the value did not change. This often happens when auto formatting.
    126125                this.layout();
Note: See TracChangeset for help on using the changeset viewer.