Procházet zdrojové kódy

Merge pull request #8334 from Repiteo/space-to-tab-v3

Reimplement space-to-tab regex without lookbehind
Max Hilbrunner před 1 rokem
rodič
revize
5aaa6648f0
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      _static/js/custom.js

+ 6 - 2
_static/js/custom.js

@@ -299,8 +299,12 @@ $(document).ready(() => {
       // Only change indentation for GDScript and C++.
       // Only change indentation for GDScript and C++.
       continue;
       continue;
     }
     }
-    let html = codeBlock.innerHTML;
-    html = html.replace(/(?<=^(<span class="w">)?( {4})*)( {4})/gm, '\t');
+    let html = codeBlock.innerHTML.replace(/^(<span class="w">)?( {4})/gm, '\t');
+    let html_old = "";
+    while (html != html_old) {
+      html_old = html;
+      html = html.replace(/\t( {4})/gm, '\t\t')
+    }
     codeBlock.innerHTML = html;
     codeBlock.innerHTML = html;
   }
   }