Title: [233968] branches/safari-606-branch/Source/WebInspectorUI
Revision
233968
Author
[email protected]
Date
2018-07-18 19:00:51 -0700 (Wed, 18 Jul 2018)

Log Message

Cherry-pick r233920. rdar://problem/42349819

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-606-branch/Source/WebInspectorUI/ChangeLog (233967 => 233968)


--- branches/safari-606-branch/Source/WebInspectorUI/ChangeLog	2018-07-19 02:00:49 UTC (rev 233967)
+++ branches/safari-606-branch/Source/WebInspectorUI/ChangeLog	2018-07-19 02:00:51 UTC (rev 233968)
@@ -1,5 +1,54 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233920. rdar://problem/42349819
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233861. rdar://problem/42345123
 
     Web Inspector: Fix execution highlighting after r233820

Modified: branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js (233967 => 233968)


--- branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2018-07-19 02:00:49 UTC (rev 233967)
+++ branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2018-07-19 02:00:51 UTC (rev 233968)
@@ -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: branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (233967 => 233968)


--- branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-07-19 02:00:49 UTC (rev 233967)
+++ branches/safari-606-branch/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-07-19 02:00:51 UTC (rev 233968)
@@ -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