Title: [248739] trunk/Source/WebInspectorUI
Revision
248739
Author
drou...@apple.com
Date
2019-08-15 12:32:14 -0700 (Thu, 15 Aug 2019)

Log Message

Web Inspector: CodeMirror still inserts a tab even when "Prefer indent using" is set to "Spaces"
https://bugs.webkit.org/show_bug.cgi?id=200770

Reviewed by Ross Kirsling.

* UserInterface/Views/CodeMirrorAdditions.js:
Remap the `insertTab` command to use `insertSoftTab` when "Prefer indent using" is set to
"Spaces" so that CodeMirror inserts the number of spaces that would match a tab ("\t") being
inserted at the same spot.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (248738 => 248739)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-08-15 19:31:13 UTC (rev 248738)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-08-15 19:32:14 UTC (rev 248739)
@@ -1,5 +1,17 @@
 2019-08-15  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: CodeMirror still inserts a tab even when "Prefer indent using" is set to "Spaces"
+        https://bugs.webkit.org/show_bug.cgi?id=200770
+
+        Reviewed by Ross Kirsling.
+
+        * UserInterface/Views/CodeMirrorAdditions.js:
+        Remap the `insertTab` command to use `insertSoftTab` when "Prefer indent using" is set to
+        "Spaces" so that CodeMirror inserts the number of spaces that would match a tab ("\t") being
+        inserted at the same spot.
+
+2019-08-15  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: Sources: the "No Filter Results" message sits on top of all of the content, preventing any interaction
         https://bugs.webkit.org/show_bug.cgi?id=200755
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js (248738 => 248739)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js	2019-08-15 19:31:13 UTC (rev 248738)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js	2019-08-15 19:32:14 UTC (rev 248739)
@@ -619,6 +619,17 @@
         fallthrough: mac ? "macDefault" : "pcDefault"
     };
 
+    {
+        // CodeMirror's default behavior is to always insert a tab ("\t") regardless of `indentWithTabs`.
+        let original = CodeMirror.commands.insertTab;
+        CodeMirror.commands.insertTab = function(cm) {
+            if (cm.options.indentWithTabs)
+                original(cm);
+            else
+                CodeMirror.commands.insertSoftTab(cm);
+        };
+    }
+
     // Register some extra MIME-types for CodeMirror. These are in addition to the
     // ones CodeMirror already registers, like text/html, text/_javascript_, etc.
     var extraXMLTypes = ["text/xml", "text/xsl"];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to