Changeset 248739 in webkit


Ignore:
Timestamp:
Aug 15, 2019 12:32:14 PM (5 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r248737 r248739  
     12019-08-15  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: CodeMirror still inserts a tab even when "Prefer indent using" is set to "Spaces"
     4        https://bugs.webkit.org/show_bug.cgi?id=200770
     5
     6        Reviewed by Ross Kirsling.
     7
     8        * UserInterface/Views/CodeMirrorAdditions.js:
     9        Remap the `insertTab` command to use `insertSoftTab` when "Prefer indent using" is set to
     10        "Spaces" so that CodeMirror inserts the number of spaces that would match a tab ("\t") being
     11        inserted at the same spot.
     12
    1132019-08-15  Devin Rousso  <drousso@apple.com>
    214
  • trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js

    r237186 r248739  
    620620    };
    621621
     622    {
     623        // CodeMirror's default behavior is to always insert a tab ("\t") regardless of `indentWithTabs`.
     624        let original = CodeMirror.commands.insertTab;
     625        CodeMirror.commands.insertTab = function(cm) {
     626            if (cm.options.indentWithTabs)
     627                original(cm);
     628            else
     629                CodeMirror.commands.insertSoftTab(cm);
     630        };
     631    }
     632
    622633    // Register some extra MIME-types for CodeMirror. These are in addition to the
    623634    // ones CodeMirror already registers, like text/html, text/javascript, etc.
Note: See TracChangeset for help on using the changeset viewer.