Skip to content

Commit 5e5c310

Browse files
Merge branch 'Acode-Foundation:main' into resizeableActivity
2 parents 4f29154 + a44708c commit 5e5c310

File tree

14 files changed

+1071
-535
lines changed

14 files changed

+1071
-535
lines changed

config.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,7 @@
5252
<action android:name="android.intent.action.EDIT" />
5353
<category android:name="android.intent.category.DEFAULT" />
5454
<category android:name="android.intent.category.LAUNCHER" />
55-
<data android:mimeType="text/*"/>
56-
<data android:mimeType="xml/*" />
57-
<data android:mimeType="application/text" />
58-
<data android:mimeType="application/xml" />
59-
<data android:mimeType="application/json" />
60-
<data android:mimeType="application/javascript" />
61-
<data android:mimeType="application/x-sh" />
62-
<data android:mimeType="application/octet-stream"/>
63-
<data pathPattern=".*\.txt"/>
64-
<data pathPattern=".*\.xml"/>
65-
<data pathPattern=".*\.json"/>
55+
<data android:mimeType="*/*"/>
6656
</intent-filter>
6757
<!-- Allow app to open using url from browser -->
6858
<intent-filter android:autoVerify="true">

src/ace/modelist.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,44 @@ export function initModes() {
66
"ace/ext/modelist",
77
["require", "exports", "module"],
88
function (require, exports, module) {
9+
/**
10+
* Calculates a specificity score for a mode.
11+
* Higher score means more specific.
12+
* - Anchored patterns (e.g., "^Dockerfile") get a base score of 1000.
13+
* - Non-anchored patterns (extensions) are scored by length.
14+
*/
15+
function getModeSpecificityScore(modeInstance) {
16+
const extensionsStr = modeInstance.extensions;
17+
if (!extensionsStr) return 0;
18+
19+
const patterns = extensionsStr.split("|");
20+
let maxScore = 0;
21+
22+
for (const pattern of patterns) {
23+
let currentScore = 0;
24+
if (pattern.startsWith("^")) {
25+
// Exact filename match or anchored pattern
26+
currentScore = 1000 + (pattern.length - 1); // Subtract 1 for '^'
27+
} else {
28+
// Extension match
29+
currentScore = pattern.length;
30+
}
31+
if (currentScore > maxScore) {
32+
maxScore = currentScore;
33+
}
34+
}
35+
return maxScore;
36+
}
937
module.exports = {
1038
getModeForPath(path) {
1139
let mode = modesByName.text;
1240
let fileName = path.split(/[\/\\]/).pop();
13-
for (const iMode of modes) {
41+
// Sort modes by specificity (descending) to check most specific first
42+
const sortedModes = [...modes].sort((a, b) => {
43+
return getModeSpecificityScore(b) - getModeSpecificityScore(a);
44+
});
45+
46+
for (const iMode of sortedModes) {
1447
if (iMode.supportsFile?.(fileName)) {
1548
mode = iMode;
1649
break;

src/components/sidebar/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ body.no-animation {
124124
width: 100%;
125125
height: 100%;
126126

127+
&.files {
128+
overflow-x: auto;
129+
}
130+
127131
> .list {
128132
width: 100%;
129133
max-width: 100%;

src/dialogs/prompt.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ import appSettings from "lib/settings";
1919
* @param {PromptOptions} options
2020
* @returns {Promise<string|number|null>} Returns null if cancelled
2121
*/
22+
2223
export default function prompt(
2324
message,
2425
defaultValue,
2526
type = "text",
2627
options = {},
2728
) {
29+
const commands = editorManager.editor.commands;
30+
const originalExec = commands.exec;
31+
32+
commands.exec = () => {}; // Disable all shortcuts
33+
2834
return new Promise((resolve) => {
2935
const inputType = type === "textarea" ? "textarea" : "input";
3036
type = type === "filename" ? "text" : type;
@@ -50,6 +56,7 @@ export default function prompt(
5056
hide();
5157
let { value } = input;
5258
if (type === "number") value = +value;
59+
5360
resolve(value);
5461
},
5562
});
@@ -151,6 +158,7 @@ export default function prompt(
151158
}
152159

153160
function hide() {
161+
commands.exec = originalExec;
154162
actionStack.remove("prompt");
155163
system.setInputType(appSettings.value.keyboardMode);
156164
hidePrompt();

0 commit comments

Comments
 (0)