Skip to content

Commit 3b77ab2

Browse files
committed
Merge remote-tracking branch 'origin/main' into filetree-toolbar
2 parents 30bb34a + f8311d0 commit 3b77ab2

56 files changed

Lines changed: 1099 additions & 315 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nightly-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
# Only run this step, if not called from another workflow. And a previous step is successful with releasedRequired=true
250250
id: release
251251
if: ${{ ! inputs.skip_tagging_and_releases && steps.check-nightly-tag-force-update.outcome == 'success' && env.releaseRequired == 'true' && !inputs.is_PR }}
252-
uses: softprops/action-gh-release@v2
252+
uses: softprops/action-gh-release@v3
253253
env:
254254
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
255255
with:

bun.lock

Lines changed: 12 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config.xml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,17 @@
3838
<preference name="GradlePluginKotlinEnabled" value="true" />
3939
<preference name="android-targetSdkVersion" value="36" />
4040

41-
<!-- Cordova does not merge this unless both of these are present -->
42-
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
43-
<application
44-
android:usesCleartextTraffic="true"
41+
42+
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
43+
<application
4544
android:networkSecurityConfig="@xml/network_security_config"
4645
android:hardwareAccelerated="true"
4746
android:largeHeap="true"
4847
android:requestLegacyExternalStorage="true"
48+
android:usesCleartextTraffic="true"
4949
android:enableOnBackInvokedCallback="false" />
5050
</edit-config>
5151

52-
<!-- Cordova does not merge this unless both of these are present -->
53-
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
54-
<application android:networkSecurityConfig="@xml/network_security_config" />
55-
<application android:usesCleartextTraffic="true" />
56-
<application android:hardwareAccelerated="true" />
57-
<application android:largeHeap="true" />
58-
<application android:requestLegacyExternalStorage="true"/>
59-
<application android:enableOnBackInvokedCallback="false" />
60-
</edit-config>
61-
6252
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
6353
<activity android:resizeableActivity="true" />
6454
</edit-config>
@@ -69,7 +59,8 @@
6959
<action android:name="android.intent.action.EDIT" />
7060
<category android:name="android.intent.category.DEFAULT" />
7161
<category android:name="android.intent.category.LAUNCHER" />
72-
<data android:mimeType="*/*"/>
62+
<data android:scheme="file" android:mimeType="*/*" />
63+
<data android:scheme="content" android:mimeType="*/*" />
7364
</intent-filter>
7465
<!-- Allow app to open using url from browser -->
7566
<intent-filter android:autoVerify="true">
@@ -92,4 +83,4 @@
9283
<hook type="after_prepare" src="hooks/post-process.js" />
9384
</platform>
9485
<preference name="AndroidBlacklistSecureSocketProtocols" value="SSLv3,TLSv1" />
95-
</widget>
86+
</widget>

package-lock.json

Lines changed: 13 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
"cordova": "13.0.0",
156156
"core-js": "^3.47.0",
157157
"dayjs": "^1.11.19",
158-
"dompurify": "^3.3.2",
158+
"dompurify": "^3.4.0",
159159
"escape-string-regexp": "^5.0.0",
160160
"esprima": "^4.0.1",
161161
"filesize": "^11.0.13",

src/cm/commandRegistry.js

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,31 @@ function registerCoreCommands() {
503503
return true;
504504
},
505505
});
506+
addCommand({
507+
name: "increaseUiZoom",
508+
description: "Increase UI zoom",
509+
readOnly: true,
510+
requiresView: false,
511+
run: () => adjustUiZoom(10),
512+
});
513+
addCommand({
514+
name: "decreaseUiZoom",
515+
description: "Decrease UI zoom",
516+
readOnly: true,
517+
requiresView: false,
518+
run: () => adjustUiZoom(-10),
519+
});
506520
addCommand({
507521
name: "increaseFontSize",
508-
description: "Increase font size",
509-
readOnly: false,
522+
description: "Increase editor font size",
523+
readOnly: true,
510524
requiresView: false,
511525
run: () => adjustFontSize(1),
512526
});
513527
addCommand({
514528
name: "decreaseFontSize",
515-
description: "Decrease font size",
516-
readOnly: false,
529+
description: "Decrease editor font size",
530+
readOnly: true,
517531
requiresView: false,
518532
run: () => adjustFontSize(-1),
519533
});
@@ -1307,12 +1321,20 @@ async function openInAppBrowserCommand() {
13071321
function adjustFontSize(delta) {
13081322
const current = settings?.value?.fontSize || "12px";
13091323
const numeric = Number.parseInt(current, 10) || 12;
1310-
const next = Math.max(1, numeric + delta);
1324+
const next = Math.min(72, Math.max(6, numeric + delta));
13111325
settings.value.fontSize = `${next}px`;
13121326
settings.update(false);
13131327
return true;
13141328
}
13151329

1330+
function adjustUiZoom(delta) {
1331+
const current = Number(settings?.value?.uiZoom) || 100;
1332+
const next = Math.min(160, Math.max(70, current + delta));
1333+
settings.value.uiZoom = next;
1334+
settings.update(false);
1335+
return true;
1336+
}
1337+
13161338
function parseKeyString(keyString) {
13171339
if (!keyString) return [];
13181340
return String(keyString)
@@ -1356,10 +1378,12 @@ function buildResolvedKeyBindingsSnapshot() {
13561378

13571379
function toCodeMirrorKey(combo) {
13581380
if (!combo) return null;
1359-
const parts = combo
1360-
.split("-")
1361-
.map((part) => part.trim())
1362-
.filter(Boolean);
1381+
const parts = combo.endsWith("-")
1382+
? [...combo.slice(0, -1).split("-").filter(Boolean), "-"]
1383+
: combo
1384+
.split("-")
1385+
.map((part) => part.trim())
1386+
.filter(Boolean);
13631387
const modifiers = [];
13641388
let key = null;
13651389

src/cm/lineNumberSelection.ts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import { EditorSelection } from "@codemirror/state";
2+
import type { BlockInfo, EditorView } from "@codemirror/view";
3+
4+
type LineInfo = Pick<BlockInfo, "from" | "to"> | null | undefined;
5+
6+
type LineNumberClickEvent = Pick<
7+
MouseEvent,
8+
| "button"
9+
| "shiftKey"
10+
| "altKey"
11+
| "ctrlKey"
12+
| "metaKey"
13+
| "preventDefault"
14+
| "defaultPrevented"
15+
>;
16+
17+
function toDocumentOffset(
18+
value: number | null | undefined,
19+
fallback = 0,
20+
): number {
21+
const resolved = value != null ? Number(value) : fallback;
22+
return Number.isFinite(resolved) ? resolved : fallback;
23+
}
24+
25+
/**
26+
* Resolve the selection range for a clicked document line.
27+
* Includes the trailing line break when one exists to mirror Ace's
28+
* full-line selection behavior.
29+
*/
30+
export function getLineSelectionRange(
31+
state: EditorView["state"],
32+
line: LineInfo,
33+
): { from: number; to: number } | null {
34+
if (!line) return null;
35+
const from = Math.max(0, toDocumentOffset(line.from));
36+
const to = Math.max(from, toDocumentOffset(line.to, from));
37+
return {
38+
from,
39+
to: Math.min(to + 1, state.doc.length),
40+
};
41+
}
42+
43+
function getCurrentSelectionLineRange(state: EditorView["state"]): {
44+
from: number;
45+
to: number;
46+
} {
47+
const selection = state.selection.main;
48+
const startLine = state.doc.lineAt(selection.from);
49+
const endPos = selection.empty
50+
? selection.head
51+
: Math.max(selection.to - 1, selection.from);
52+
const endLine = state.doc.lineAt(endPos);
53+
const startRange = getLineSelectionRange(state, startLine);
54+
const endRange = getLineSelectionRange(state, endLine);
55+
56+
return {
57+
from: startRange?.from ?? selection.from,
58+
to: endRange?.to ?? selection.to,
59+
};
60+
}
61+
62+
function createLineSelection(range: {
63+
from: number;
64+
to: number;
65+
}): EditorSelection {
66+
return EditorSelection.single(range.to, range.from);
67+
}
68+
69+
function createExtendedLineSelection(
70+
state: EditorView["state"],
71+
clickedRange: { from: number; to: number },
72+
): EditorSelection {
73+
const currentRange = getCurrentSelectionLineRange(state);
74+
const from = Math.min(currentRange.from, clickedRange.from);
75+
const to = Math.max(currentRange.to, clickedRange.to);
76+
77+
if (clickedRange.from <= currentRange.from) {
78+
return EditorSelection.single(to, from);
79+
}
80+
81+
return EditorSelection.single(from, to);
82+
}
83+
84+
/**
85+
* Select the clicked line from the line-number gutter.
86+
* Shift-click extends the current selection by whole lines.
87+
* Other modified or non-primary clicks are ignored so they don't interfere
88+
* with context menus or alternate selection gestures.
89+
*/
90+
export function handleLineNumberClick(
91+
view: EditorView | null | undefined,
92+
line: LineInfo,
93+
event: LineNumberClickEvent | null | undefined,
94+
): boolean {
95+
if (!view || !event || event.defaultPrevented) return false;
96+
if ((event.button ?? 0) !== 0) return false;
97+
if (event.altKey || event.ctrlKey || event.metaKey) {
98+
return false;
99+
}
100+
101+
const range = getLineSelectionRange(view.state, line);
102+
if (!range) return false;
103+
104+
event.preventDefault();
105+
view.dispatch({
106+
selection: event.shiftKey
107+
? createExtendedLineSelection(view.state, range)
108+
: createLineSelection(range),
109+
userEvent: event.shiftKey ? "select.extend.pointer" : "select.pointer",
110+
});
111+
view.focus();
112+
return true;
113+
}
114+
115+
export default handleLineNumberClick;

0 commit comments

Comments
 (0)