Title: [195723] trunk/Source/WebInspectorUI
Revision
195723
Author
[email protected]
Date
2016-01-27 18:14:34 -0800 (Wed, 27 Jan 2016)

Log Message

CodeMirror will strip out "\r" from files with "\r\n" as newlines causing our offsets into the file to be incorrect
https://bugs.webkit.org/show_bug.cgi?id=153529
<rdar://problem/24376799>

Reviewed by Timothy Hatcher.

This problem manifested in the type token annotator inserting
tokens in the wrong places. Because our offsets are computed
based on the resource we get from backend, CodeMirror changing
the source text will cause all of our offsets to be incorrect.

* UserInterface/Views/CodeMirrorEditor.js:
(WebInspector.CodeMirrorEditor.create):
(WebInspector.CodeMirrorEditor):
* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.set string.update):
(WebInspector.TextEditor.prototype.set string):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (195722 => 195723)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-01-28 01:36:06 UTC (rev 195722)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-01-28 02:14:34 UTC (rev 195723)
@@ -1,3 +1,23 @@
+2016-01-27  Saam barati  <[email protected]>
+
+        CodeMirror will strip out "\r" from files with "\r\n" as newlines causing our offsets into the file to be incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=153529
+        <rdar://problem/24376799>
+
+        Reviewed by Timothy Hatcher.
+
+        This problem manifested in the type token annotator inserting
+        tokens in the wrong places. Because our offsets are computed
+        based on the resource we get from backend, CodeMirror changing
+        the source text will cause all of our offsets to be incorrect.
+
+        * UserInterface/Views/CodeMirrorEditor.js:
+        (WebInspector.CodeMirrorEditor.create):
+        (WebInspector.CodeMirrorEditor):
+        * UserInterface/Views/TextEditor.js:
+        (WebInspector.TextEditor.set string.update):
+        (WebInspector.TextEditor.prototype.set string):
+
 2016-01-27  Devin Rousso  <[email protected]>
 
         Web Inspector: Regression (r195303) - Changes to TreeOutline break styling of lists in Visual sidebar

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js (195722 => 195723)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2016-01-28 01:36:06 UTC (rev 195722)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2016-01-28 02:14:34 UTC (rev 195723)
@@ -27,6 +27,9 @@
 {
     static create(place, options)
     {
+        if (options.lineSeparator === undefined)
+            options.lineSeparator = "\n";
+
         let codeMirror = new CodeMirror(place, options);
 
         // Set up default controllers that should be present for
@@ -35,4 +38,4 @@
 
         return codeMirror;
     }
-}
\ No newline at end of file
+}

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (195722 => 195723)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-01-28 01:36:06 UTC (rev 195722)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-01-28 02:14:34 UTC (rev 195723)
@@ -90,6 +90,7 @@
                 this._codeMirror.removeLineClass(0, "wrap");
 
             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.");
 
             if (this._initialStringNotSet) {
                 this._codeMirror.clearHistory();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to