Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
21b7f70
showFileInfo faster word counting, 10-20%
Palloxin Nov 14, 2026
c063149
Update immersive-fullscreen.js
Palloxin Nov 16, 2026
68e993b
Update post-process.js
Palloxin Nov 16, 2026
8098e41
Update clientManager.ts
Palloxin Nov 16, 2026
2176552
Update documentColors.ts
Palloxin Nov 16, 2026
1491f8d
Update index.js
Palloxin Nov 16, 2026
d018640
Update canvasOptions.ts
Palloxin Nov 16, 2026
e0e562f
Update canvasOptions.ts
Palloxin Nov 16, 2026
18c6d83
Update commandRegistry.js
Palloxin Nov 16, 2026
9685bff
Update commandRegistry.js
Palloxin Nov 16, 2026
ed3cd56
Update supportedModes.ts
Palloxin Nov 16, 2026
6a1b2b2
Update console.js
Palloxin Nov 16, 2026
33b8bc1
Update editorFile.js
Palloxin Nov 16, 2026
5018a0b
Update fonts.js
Palloxin Nov 16, 2026
dd329b3
Update keyBindings.js
Palloxin Nov 16, 2026
ed6f7dd
Update prettierFormatter.js
Palloxin Nov 16, 2026
7574af2
Update showFileInfo.js
Palloxin Nov 16, 2026
0d8b97a
Update customTheme.js
Palloxin Nov 16, 2026
915a824
Update fileBrowser.js
Palloxin Nov 16, 2026
0e83771
Update fontManager.js
Palloxin Nov 16, 2026
90d8f63
Update renderer.js
Palloxin Nov 16, 2026
804a4c3
Update welcome.js
Palloxin Nov 16, 2026
91459af
Update worker.js
Palloxin Nov 16, 2026
2398282
Update fileOperationExclusions.js
Palloxin Nov 16, 2026
76dc32a
Update Path.js
Palloxin Nov 16, 2026
2e06c7c
Update Uri.js
Palloxin Nov 16, 2026
e2f540a
Update Url.js
Palloxin Nov 16, 2026
500b2e8
fix lint
Palloxin Nov 16, 2026
a158df1
Update commandRegistry.js
Palloxin Nov 16, 2026
253cfb8
Update fonts.js
Palloxin Nov 16, 2026
19ee17e
fix lint
Palloxin Nov 16, 2026
69117f5
Update fonts.js
Palloxin Nov 16, 2026
9733d6a
fix lint
Palloxin Nov 16, 2026
99bdf6c
final lint fix
Palloxin Nov 16, 2026
bd6d943
true final lint fix
Palloxin Nov 16, 2026
f934bae
tiny fix
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
Expand Up @@ -302,7 +302,7 @@ export function getCanvasTheme(
): 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 @@ let nextThemeEntryId = 1;
*/
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
Expand Up @@ -1343,8 +1343,8 @@ function runLspCommand(commandFn, options = {}) {

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
Expand Up @@ -1458,7 +1458,7 @@ function applyTextEdits(
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 contentUriToFileUri(uri: string): string | null {
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
Expand Up @@ -213,7 +213,7 @@ function applyTextEdits(
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
6 changes: 3 additions & 3 deletions src/cm/supportedModes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function isSafeModeId(value: string): boolean {

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
Expand Up @@ -180,7 +180,7 @@ export function getThemeConfig(id) {
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
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
Expand Up @@ -967,7 +967,7 @@ export default class EditorFile {
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
4 changes: 2 additions & 2 deletions src/lib/keyBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ function parseKeyParts(combo) {

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
Expand Up @@ -466,7 +466,7 @@ function evaluateUnaryExpression(node, scope) {
}

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
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
3 changes: 1 addition & 2 deletions src/pages/customTheme/customTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export default function CustomThemeInclude() {
}

function render() {
const pascalToNormal = (str) =>
str.replace(/([A-Z])/g, " $1").toLowerCase();
const pascalToNormal = (str) => 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
5 changes: 4 additions & 1 deletion src/sidebarApps/searchInFiles/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ function getSurrounding(content, word, start, end) {
if (left > 0 && !/[\r\n]/.test(content[left - 1])) line = `...${line}`;
if (right < content.length && !/[\r\n]/.test(content[right])) line += "...";
return [line, word.slice(0, max)].map((text) =>
text.replace(/[\r\n]+/g, " ⏎ "),
text
.replaceAll("\r\n", " ⏎ ")
.replaceAll("\n", " ⏎ ")
.replaceAll("\r", " ⏎ "),
);
}

Expand Down
3 changes: 1 addition & 2 deletions src/utils/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ export default {
* @param {string} path
*/
normalize(path) {
path = path.replace(/\.\/+/g, "./");
path = path.replace(/\/+/g, "/");
path = path.replace(/\/\/+/g, "/");

const resolved = [];
const pathAr = path.split("/");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default {
const { name } = storage;
const [base, paths] = url.split("::");
url = base + "/" + paths.split("/").slice(1).join("/");
return url.replace(regex, name).replace(/\/+/g, "/");
return url.replace(regex, name).replace(/\/\/+/g, "/");
}

return url;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Url.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export default {
const uuid = "uuid" + Math.floor(Math.random() + Date.now() * 1000000);

if (/#/.test(url)) {
url = url.replace(/#/g, uuid);
url = url.replaceAll("#", uuid);
}

let { username, password, hostname, pathname, port, query } = URLParse(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fileOperationExclusions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function isExcludedFileOperationPath(url, patterns = []) {

const parsedUrl = Url.parse(url).url;
const pathname = Url.pathname(parsedUrl) || parsedUrl;
const normalizedPath = pathname.replace(/\\/g, "/").replace(/\/+$/, "");
const normalizedPath = pathname.replaceAll("\\", "/").replace(/\/+$/, "");
const relativePath = normalizedPath.replace(/^\/+/, "");
const candidates = [
normalizedPath,
Expand Down
Loading