Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f6b8044
Faster regexes
Palloxin Nov 14, 2026
9556ce3
showFileInfo.js , faster word counting by 10-20%
Palloxin Nov 14, 2026
df1d7a7
weird regex, badly made
Palloxin Nov 14, 2026
1934bca
faster \n deletation in case of bulk
Palloxin Nov 14, 2026
b085b3d
non capture group + the ' faster in bulk case
Palloxin Nov 14, 2026
c1a9eb1
forgot
Palloxin Nov 14, 2026
4d30f2a
faster in case of bulk
Palloxin Nov 14, 2026
48a9a2e
faster if bulk
Palloxin Nov 14, 2026
6912582
faster if bulk
Palloxin Nov 14, 2026
e1acbf8
blunder correction
Palloxin Nov 14, 2026
411b3f5
my blunder correction
Palloxin Nov 14, 2026
36743a1
Update umd-tough-cookie.js
Palloxin Nov 14, 2026
39bdf69
mistake correction
Palloxin Nov 14, 2026
161218b
correction
Palloxin Nov 14, 2026
c0f0329
Correction due to "file." case
Palloxin Nov 14, 2026
8d45aca
Last improvements
Palloxin Nov 14, 2026
6f9fd90
faster line count if not regex
Palloxin Nov 15, 2026
395f626
faster + replaceAll
Palloxin Nov 15, 2026
45b8a0f
replaceAll
Palloxin Nov 15, 2026
dd65304
replaceAll
Palloxin Nov 15, 2026
d2dd385
replaceAll
Palloxin Nov 15, 2026
953ced5
replaceAll
Palloxin Nov 15, 2026
0e7bf5e
replaceAll
Palloxin Nov 15, 2026
35aa071
ReplaceAll
Palloxin Nov 15, 2026
aa31f92
ReplaceAll
Palloxin Nov 15, 2026
7df58b4
ReplaceAll
Palloxin Nov 15, 2026
daaace2
bad regex
Palloxin Nov 15, 2026
ad293f8
ReplaceAll
Palloxin Nov 15, 2026
642065a
faster
Palloxin Nov 15, 2026
70e9fee
replaceall
Palloxin Nov 15, 2026
763ad34
replaceAll
Palloxin Nov 15, 2026
ba80067
no group
Palloxin Nov 15, 2026
46345b5
correction
Palloxin Nov 15, 2026
1b03864
ReplaceAll
Palloxin Nov 15, 2026
2cea637
no group
Palloxin Nov 15, 2026
2dc8fd1
replaceall
Palloxin Nov 15, 2026
b54195e
fasterr
Palloxin Nov 15, 2026
6a5f2ac
replaceall and groupless
Palloxin Nov 15, 2026
7953c1c
double replaceAll faster
Palloxin Nov 15, 2026
2749524
bad regex
Palloxin Nov 15, 2026
79b10c1
fas
Palloxin Nov 15, 2026
cb88137
replaceAll
Palloxin Nov 15, 2026
52b84cd
replaceAll
Palloxin Nov 15, 2026
5bf4ca4
left a comment due to doubt
Palloxin Nov 15, 2026
c12c7ba
less groups
Palloxin Nov 15, 2026
1bf087f
string instead of regex
Palloxin Nov 15, 2026
f1afdc2
no group
Palloxin Nov 15, 2026
58dbba6
weird
Palloxin Nov 15, 2026
63394e0
weird
Palloxin Nov 15, 2026
240202e
replacea
Palloxin Nov 15, 2026
ec19989
weird regex
Palloxin Nov 15, 2026
63959de
\b
Palloxin Nov 15, 2026
22ba879
mistake corr
Palloxin Nov 16, 2026
0ffce7b
fixed mistake
Palloxin Nov 16, 2026
0291552
fixed mist
Palloxin Nov 16, 2026
4ecc5ca
fx mistak
Palloxin Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hooks/immersive-fullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ module.exports = function prepareImmersiveFullscreen(context) {
// Markers delimit our generated blocks so each prepare can replace them safely,
// including when only the controller changes.
let source = original
.replace(/\r\n/g, "\n")
.replaceAll('\r\n', '\n')
.replace(
/^[ \t]*\/\/ ACODE_FULLSCREEN_BEGIN ([a-z]+)\n[\s\S]*?^[ \t]*\/\/ ACODE_FULLSCREEN_END \1\n/gm,
/^[ \t]*\/\/ ACODE_FULLSCREEN_BEGIN ([a-z]+)\n[^]*?^[ \t]*\/\/ ACODE_FULLSCREEN_END \1\n/gm,
"",
);
if (/ACODE_FULLSCREEN_(BEGIN|END)/.test(source)) {
Expand Down
8 changes: 4 additions & 4 deletions hooks/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function stripLauncherFilterFromMainActivity() {

let content = fs.readFileSync(manifestPath, 'utf-8');
const updated = content.replace(
/(<activity[^>]*\bname="MainActivity"[^>]*>)\s*<intent-filter[^>]*>\s*<action android:name="android\.intent\.action\.MAIN"[^>]*\/>\s*<category android:name="android\.intent\.category\.LAUNCHER"[^>]*\/>\s*<\/intent-filter>/,
/(<activity[^>]*?\bname="MainActivity"[^>]*>)\s*<intent-filter[^>]*>\s*<action android:name="android\.intent\.action\.MAIN"[^>]*\/>\s*<category android:name="android\.intent\.category\.LAUNCHER"[^>]*\/>\s*<\/intent-filter>/,
'$1'
);

Expand Down Expand Up @@ -200,7 +200,7 @@ function enableStaticContext() {
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
packageName.replaceAll('.', '/'),
'MainActivity.java'
);

Expand Down Expand Up @@ -262,7 +262,7 @@ function disableSplashFadeOnRealmeAndroid13() {
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
packageName.replaceAll('.', '/'),
'MainActivity.java'
);

Expand Down Expand Up @@ -335,7 +335,7 @@ function removeLegacyKeyboardWorkaround() {
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
packageName.replaceAll('.', '/'),
'MainActivity.java'
);

Expand Down
4 changes: 2 additions & 2 deletions src/cm/canvasOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check failure on line 1 in src/cm/canvasOptions.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
type CanvasThemeSpec,
CanvasView,
type CanvasViewConfig,
Expand Down Expand Up @@ -302,7 +302,7 @@
): CanvasThemeSpec {
// Resolve ids like getThemeExtensions does ("one-dark" -> "one_dark").
const theme =
getThemeById(themeId) || getThemeById(String(themeId).replace(/-/g, "_"));
getThemeById(themeId) || getThemeById(String(themeId).replaceAll('-', "_"));
const config = (theme?.config ||
getThemeConfig(themeId) ||
{}) as ThemeConfig;
Expand Down Expand Up @@ -541,7 +541,7 @@
*/
function themeEntryKey(themeId: string): string {
const entry =
getThemeById(themeId) || getThemeById(String(themeId).replace(/-/g, "_"));
getThemeById(themeId) || getThemeById(String(themeId).replaceAll('-', "_"));
if (!entry) return "0";
let n = themeEntryIds.get(entry);
if (!n) themeEntryIds.set(entry, (n = nextThemeEntryId++));
Expand Down
4 changes: 2 additions & 2 deletions src/cm/commandRegistry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fsOperation from "fileSystem";

Check failure on line 1 in src/cm/commandRegistry.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import * as cmCommands from "@codemirror/commands";
import {
cursorCharLeft,
Expand Down Expand Up @@ -1343,8 +1343,8 @@

function humanizeCommandName(name) {
return name
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
.replace(/_/g, " ")
.replace(/[a-z0-9](?=[A-Z])/g, "$& ")
.replaceAll('_', ' ')
.replace(/^./, (char) => char.toUpperCase());
}

Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/clientManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getIndentUnit, indentUnit } from "@codemirror/language";

Check failure on line 1 in src/cm/lsp/clientManager.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import type {
LSPClientExtension,
LSPPluginOptions,
Expand Down Expand Up @@ -1458,7 +1458,7 @@
if (fromResult == null || toResult == null) continue;
const insert =
typeof edit.newText === "string"
? edit.newText.replace(/\r\n/g, "\n")
? edit.newText.replaceAll('\r\n', '\n')
: "";
changes.push({ from: fromResult, to: toResult, insert });
}
Expand Down Expand Up @@ -1639,6 +1639,6 @@
function buildFileUri(pathname: string): string | null {
if (!pathname) return null;
const normalized = pathname.startsWith("/") ? pathname : `/${pathname}`;
const encoded = encodeURI(normalized).replace(/#/g, "%23");
const encoded = encodeURI(normalized).replaceAll('#', '%23');
return `file://${encoded}`;
}
2 changes: 1 addition & 1 deletion src/cm/lsp/documentColors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LSPClient, LSPClientExtension } from "@codemirror/lsp-client";

Check failure on line 1 in src/cm/lsp/documentColors.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import { LSPPlugin } from "@codemirror/lsp-client";
import type { Extension, Range } from "@codemirror/state";
import { MapMode, StateEffect, StateField } from "@codemirror/state";
Expand Down Expand Up @@ -213,7 +213,7 @@
if (!mapped) continue;
const insert =
typeof edit.newText === "string"
? edit.newText.replace(/\r\n/g, "\n")
? edit.newText.replaceAll('\r\n', '\n')
: "";
changes.push({ from: mapped.from, to: mapped.to, insert });
}
Expand Down
2 changes: 1 addition & 1 deletion src/cm/lsp/installRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function quoteArg(value: unknown): string {
const str = String(value ?? "");
if (!str.length) return "''";
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(str)) return str;
return `'${str.replace(/'/g, "'\\''")}'`;
return `'${str.replaceAll("'", "'\\''")}'`;
}

export function formatCommand(
Expand Down
2 changes: 1 addition & 1 deletion src/cm/modelist.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Extension } from "@codemirror/state";

Check failure on line 1 in src/cm/modelist.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output

export type LanguageExtensionProvider = () => Extension | Promise<Extension>;

Expand Down Expand Up @@ -388,7 +388,7 @@
this.name = name;
this.mode = name; // CodeMirror uses different mode naming
this.extensions = extensions;
this.caption = caption || this.name.replace(/_/g, " ");
this.caption = caption || this.name.replaceAll('_', ' ');
// Plugins may pass anything here; ignore what isn't the expected shape
const { aliases, filenameMatchers, formatAs } =
options && typeof options === "object" ? options : {};
Expand Down
6 changes: 3 additions & 3 deletions src/cm/supportedModes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { languages } from "@codemirror/language-data";

Check failure on line 1 in src/cm/supportedModes.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import type { Extension } from "@codemirror/state";
import { addMode } from "./modelist";

Expand All @@ -25,9 +25,9 @@

function slugifyModeId(value: string): string {
return normalizeModeKey(value)
.replace(/\+\+/g, "pp")
.replace(/#/g, "sharp")
.replace(/&/g, "and")
.replaceAll('++', 'pp')
.replaceAll('#', 'sharp')
.replaceAll('&', 'and')
.replace(/[^a-z0-9._-]+/g, "-")
.replace(/^-+|-+$/g, "");
}
Expand Down
2 changes: 1 addition & 1 deletion src/cm/themes/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";

Check failure on line 1 in src/cm/themes/index.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import { EditorState } from "@codemirror/state";
import {
oneDark,
Expand Down Expand Up @@ -180,7 +180,7 @@
export function getThemeExtensions(id, fallback = [oneDark]) {
const fallbackExtensions = normalizeExtensions(fallback);
const theme =
getThemeById(id) || getThemeById(String(id || "").replace(/-/g, "_"));
getThemeById(id) || getThemeById(String(id || "").replaceAll('-', '_'));
return resolveThemeEntryExtensions(theme, fallbackExtensions);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let hasPro = false;
const config = {
BASE_URL,
SUPPORTED_EDITOR: "cm",
FILE_NAME_REGEX: /^((?![:<>"\\\|\?\*]).)*$/,
FILE_NAME_REGEX: /^([^:<>"\\\|\?\*])*$/,
FONT_SIZE: /^[0-9\.]{1,3}(px|rem|em|pt|mm|pc|in)$/,
DEFAULT_FILE_SESSION: "default-session",
DEFAULT_FILE_NAME: "untitled.txt",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ import ConsoleExecutor, {
} catch (error) {
return data
.toString()
.replace(/({).*(})/, "$1...$2")
.replace(/{.*}/, "...")
.replace(/^function\s+[\w_$\d]+\s*/, "")
.replace(/\s*/g, "");
.replace(/\s+/g, "");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/editorFile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fsOperation, { hasProvider } from "fileSystem";

Check failure on line 1 in src/lib/editorFile.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
// CodeMirror imports for document state management
import { EditorSelection, EditorState } from "@codemirror/state";
import {
Expand Down Expand Up @@ -967,7 +967,7 @@
if (value === "windows") {
text = text.replace(/\n(?<!\r\n)/g, "\r\n");
} else {
text = text.replace(/\r/g, "");
text = text.replaceAll('\r', '');
}

// Update the document in the session
Expand Down
2 changes: 1 addition & 1 deletion src/lib/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ async function loadFont(name) {
}

// Get all URL font references
const urls = [...css.matchAll(/url\((.*?)\)/g)].map((match) => match[1]);
const urls = [...css.matchAll(/\burl\(([^)]*)\)/g)].map((match) => match[1]);

// Download and replace URLs
for (const url of urls) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/keyBindings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as cmCommands from "@codemirror/commands";

Check failure on line 1 in src/lib/keyBindings.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import {
defaultKeymap,
emacsStyleKeymap,
Expand Down Expand Up @@ -928,8 +928,8 @@

function humanizeCommandName(name) {
return name
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
.replace(/_/g, " ")
.replace(/[a-z0-9](?=[A-Z])/g, "$& ")
.replaceAll('_', ' ')
.replace(/^./, (char) => char.toUpperCase());
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/prettierFormatter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fsOperation from "fileSystem";

Check failure on line 1 in src/lib/prettierFormatter.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import { parse } from "acorn";
import { getDocText } from "cm/editorUtils";
import { getFormatAsMode } from "cm/modelist";
Expand Down Expand Up @@ -466,7 +466,7 @@
}

function normalizePath(path) {
let result = String(path || "").replace(/\\/g, "/");
let result = String(path || "").replaceAll('\\', '/');
while (result.length > 1 && result.endsWith("/")) {
const prefix = result.slice(0, -1);
if (/^[a-z]+:\/{0,2}$/i.test(prefix)) break;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ async function run(
scripts.forEach(function(el){document.head.removeChild(el)});
}, 0);
</script><!-- Injected code, this is not present in original code -->`;
text = text.replace(/><\/script>/g, ' crossorigin="anonymous"></script>');
text = text.replaceAll('></script>', ' crossorigin="anonymous"></script>');
const part = text.split("<head>");
if (part.length === 2) {
text = `${part[0]}<head>${js}${part[1]}`;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/showFileInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default async function showFileInfo(url) {

if (options.isEditor) {
const value = await fs.readFile(settings.value.defaultFileEncoding);
options.lineCount = value.split(/\n+/).length;
options.wordCount = value.split(/\s+|\n+/).length;
options.lineCount = value.split("\n").length;
options.wordCount = value.split(/\S+/).length;
Comment thread
Palloxin marked this conversation as resolved.
Resolved

if (/s?ftp:/.test(protocol)) {
options.shareUri = Url.join(CACHE_STORAGE, name);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/customTheme/customTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function CustomThemeInclude() {

function render() {
const pascalToNormal = (str) =>
str.replace(/([A-Z])/g, " $1").toLowerCase();
str.replace(/[A-Z]/g, " $&").toLowerCase();
const customTheme = themes.get("custom");

$page.body = (
Expand Down
8 changes: 4 additions & 4 deletions src/pages/fileBrowser/fileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
let parts;
if (typeof dir === "string") {
if (dir.endsWith("/")) wantDirEnd = true;
dir = dir.replace(/\\/g, "/");
dir = dir.replaceAll('\\', '/');
parts = dir.split("/");
} else {
parts = dir;
Expand Down Expand Up @@ -390,7 +390,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
const sanitizeZipPath = (p, isDir) => {
if (!p) return "";
let path = String(p);
path = path.replace(/\\/g, "/");
path = path.replaceAll('\\', '/');
path = path.replace(/^[a-zA-Z]+:\/\//, "");
path = path.replace(/^\/+/, "");
path = path.replace(/^[A-Za-z]:\//, "");
Expand Down Expand Up @@ -431,7 +431,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
`Extracting ${filePath} (${Math.round((current / total) * 100)}%)`,
);

let correctFile = filePath.replace(/\\/g, "/");
let correctFile = filePath.replaceAll('\\', '/');
const isDirEntry = entry.dir || correctFile.endsWith("/");

if (isUnsafeAbsolutePath(filePath)) {
Expand Down Expand Up @@ -1661,7 +1661,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
const fs = fsOperation(lclUrl);

if (paths.length === 0) {
const data = project[fileUrl].replace(/<%name%>/g, projectName);
const data = project[fileUrl].replaceAll('<%name%>', projectName);
await fs.createFile(filename, data);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/fontManager/fontManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function fontManager() {

const fontName = await prompt(
"Font Name",
name.replace(/\.(ttf|otf|woff|woff2)$/i, ""),
name.replace(/\.(?:ttf|otf|woff|woff2)$/i, ""),
);
if (!fontName) return;

Expand Down
2 changes: 1 addition & 1 deletion src/pages/markdownPreview/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function slugify(text) {
.trim()
.toLowerCase()
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/[\u0300-\u036f]+/g, "")
.replace(/[^\p{L}\p{N}]+/gu, "-")
.replace(/^-+|-+$/g, "");
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/welcome/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function createWelcomeContent() {
const bindings = getResolvedKeyBindings();
const kb = (name) => {
const binding = bindings[name];
return binding?.key ? binding.key.split("|")[0].replace(/-/g, "+") : "";
return binding?.key ? binding.key.split("|")[0].replaceAll('-', '+') : "";
};

return (
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/browser/utils/updatePackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function replaceImport(filePath, appName) {
const data = fs.readFileSync(filePath, "utf8");

const updated = data.replace(
/(import\s+com\.foxdebug\.)(acode|acodefree)(\.R;)/,
`$1${appName}$3`
/(import\s+com\.foxdebug\.)(?:acode|acodefree)(?=\.R;)/,
`$1${appName}`
);

fs.writeFileSync(filePath, updated);
Expand Down Expand Up @@ -55,4 +55,4 @@ try {
} catch (error) {
console.error("❌ Error:", error.message);
process.exit(1);
}
}
Loading
Loading