Title: [233920] trunk/Source/WebInspectorUI
Revision
233920
Author
[email protected]
Date
2018-07-18 11:40:14 -0700 (Wed, 18 Jul 2018)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (233919 => 233920)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-07-18 18:35:16 UTC (rev 233919)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-07-18 18:40:14 UTC (rev 233920)
@@ -1,3 +1,25 @@
+2018-07-18  Matt Baker  <[email protected]>
+
+        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.
+
 2018-07-16  Matt Baker  <[email protected]>
 
         Web Inspector: Fix execution highlighting after r233820

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js (233919 => 233920)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2018-07-18 18:35:16 UTC (rev 233919)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2018-07-18 18:40:14 UTC (rev 233920)
@@ -27,10 +27,6 @@
 {
     static create(element, options)
     {
-        // Default line endings match typical expected line endings for _javascript_ (at least those supported by _javascript_Core).
-        if (options.lineSeparator === undefined)
-            options.lineSeparator = /\r\n?|\n/;
-
         // CodeMirror's manual scrollbar positioning results in double scrollbars,
         // nor does it handle braces and brackets well, so default to using LTR.
         // Clients can override this if custom layout for RTL is available.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (233919 => 233920)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-07-18 18:35:16 UTC (rev 233919)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-07-18 18:40:14 UTC (rev 233920)
@@ -118,10 +118,9 @@
             if (this._initialStringNotSet)
                 this._codeMirror.removeLineClass(0, "wrap");
 
-            if (this._codeMirror.getValue() !== newString) {
+            if (this._codeMirror.getValue() !== newString)
                 this._codeMirror.setValue(newString);
-                console.assert(this.string.length === newString.length, "A lot of our code depends on precise text offsets, so the string should remain the same.");
-            } else {
+            else {
                 // Ensure we at display content even if the value did not change. This often happens when auto formatting.
                 this.layout();
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to