Skip to content

Commit 5e02f90

Browse files
authored
Merge branch 'Acode-Foundation:main' into main
2 parents 78faf69 + 1791ff3 commit 5e02f90

23 files changed

Lines changed: 938 additions & 171 deletions

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Change Log
22

3+
## v1.11.5 (963)
4+
5+
* Alpine Linux Backend by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1401
6+
* fix: html escaping for console page by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1411
7+
* Create plugin for native libs by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1413
8+
* feat: terminal frontend by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1415
9+
* Update hu-hu.json translation by @summoner001 in https://github.com/Acode-Foundation/Acode/pull/1423, https://github.com/Acode-Foundation/Acode/pull/1425, https://github.com/Acode-Foundation/Acode/pull/1440
10+
* chore: update id-id.json translation by @hyperz111 in https://github.com/Acode-Foundation/Acode/pull/1424, https://github.com/Acode-Foundation/Acode/pull/1447
11+
* All file access permission for terminal by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1426
12+
* refactor: plugins page by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1428
13+
* Fixed infinite scrolling in case of filtering on both plugin page and sidebar
14+
* Ui improvements on plugin page
15+
* Revamped few themes(fixes visibility issue) and Added few new ones by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1430
16+
* New theme: Neon, Sunset, Glass, Glass Dark
17+
* Revamped themes: System (Dark & Light), Oled, Light
18+
* System theme option is available on free too.
19+
* fix: scaling issue by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1431
20+
* fix: quicktools toggler responsiveness(scaling) and migrate biome by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1442
21+
* chore: update ace to v1.43.2 by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1443
22+
* feat: add uninstall option in terminal setting and tab subtitle fixes by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1445
23+
* feat: alpine document provider(exposes terminal public dir to saf picker) by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1444
24+
* feat: improved logging + fix terminal installation failure by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1446
25+
* some terminal related quality improvements by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1449
26+
* fix: dont start selection in case of back gesture
27+
* remove useless border-radius from terminal container
28+
* fix: improve terminal cursor positioning for mobile keyboard events
29+
* fix: update terminal container background when theme changes
30+
* exclude alpine/public while backup by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1450
31+
* Custom port support in Terminal manager by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1459
32+
* 🌐 i18n(locale): update vietnamese translations by @Nekitori17 in https://github.com/Acode-Foundation/Acode/pull/1461
33+
* fix: infinite loading when previewing by @RohitKushvaha01 in https://github.com/Acode-Foundation/Acode/pull/1460
34+
* Feat/some improvements to terminal and its api by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1463
35+
* Fixes/sidebar extension state by clearing and active autocompletion box background by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1466
36+
* feat: add terminal like search and replace history by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1467
37+
* fix: theme issue in terminal context menu
38+
* fix: prevent folder paste loops and improve SAF handling(termux) in cut operation by @bajrangCoder in https://github.com/Acode-Foundation/Acode/pull/1474
39+
- Add validation to prevent pasting folders into themselves or subdirectories
40+
- Implement special Termux SAF handling for cut operations with recursive file/folder moving
41+
- Fix createFileStructure to handle nested paths (foo/bar) for file:// URIs
42+
343
## v1.11.4 (962)
444

545
* Fix renaming current Termux URI file whilst viewing/editing it by @peasneovoyager2banana2

config.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8' ?>
2-
<widget id="com.foxdebug.acode" android-versionCode="962" version="1.11.4"
2+
<widget id="com.foxdebug.acode" android-versionCode="963" version="1.11.5"
33
xmlns="http://www.w3.org/ns/widgets"
44
xmlns:android="http://schemas.android.com/apk/res/android"
55
xmlns:cdv="http://cordova.apache.org/ns/1.0">
@@ -37,7 +37,6 @@
3737
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
3838
<application android:networkSecurityConfig="@xml/network_security_config" />
3939
<application android:hardwareAccelerated="true" />
40-
<application android:requestLegacyExternalStorage="true" />
4140
<application android:largeHeap="true" />
4241
<application android:requestLegacyExternalStorage="true"/>
4342
</edit-config>

package-lock.json

Lines changed: 3 additions & 24 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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.foxdebug.acode",
33
"displayName": "Acode",
4-
"version": "1.11.4",
4+
"version": "1.11.5",
55
"description": "Acode is a code editor for android",
66
"scripts": {
77
"lang": "node ./utils/lang.js",
@@ -36,7 +36,6 @@
3636
},
3737
"cordova-plugin-websocket": {},
3838
"cordova-plugin-buildinfo": {},
39-
"com.foxdebug.acode.rk.exec.proot": {},
4039
"cordova-plugin-system": {},
4140
"com.foxdebug.acode.rk.exec.terminal": {}
4241
},
@@ -64,7 +63,6 @@
6463
"@types/url-parse": "^1.4.11",
6564
"autoprefixer": "^10.4.19",
6665
"babel-loader": "^9.1.3",
67-
"com.foxdebug.acode.rk.exec.proot": "file:src/plugins/proot",
6866
"com.foxdebug.acode.rk.exec.terminal": "file:src/plugins/terminal",
6967
"cordova-android": "^13.0.0",
7068
"cordova-clipboard": "^1.3.0",

src/components/terminal/terminal.js

Lines changed: 101 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default class TerminalComponent {
3131
scrollOnUserInput: true,
3232
rows: options.rows || 24,
3333
cols: options.cols || 80,
34+
port: options.port || 8767,
3435
fontSize: terminalSettings.fontSize,
3536
fontFamily: terminalSettings.fontFamily,
3637
fontWeight: terminalSettings.fontWeight,
@@ -128,7 +129,7 @@ export default class TerminalComponent {
128129
let lastKnownScrollPosition = 0;
129130
let isResizing = false;
130131
let resizeCount = 0;
131-
const RESIZE_DEBOUNCE = 150;
132+
const RESIZE_DEBOUNCE = 100;
132133
const MAX_RAPID_RESIZES = 3;
133134

134135
// Store original dimensions for comparison
@@ -170,8 +171,37 @@ export default class TerminalComponent {
170171
await this.resizeTerminal(size.cols, size.rows);
171172
}
172173

173-
// Preserve scroll position for content-heavy terminals
174-
this.preserveViewportPosition(lastKnownScrollPosition);
174+
// Handle keyboard resize cursor positioning
175+
const heightRatio = size.rows / originalRows;
176+
if (
177+
heightRatio < 0.75 &&
178+
this.terminal.buffer &&
179+
this.terminal.buffer.active
180+
) {
181+
// Keyboard resize detected - ensure cursor is visible
182+
const buffer = this.terminal.buffer.active;
183+
const cursorY = buffer.cursorY;
184+
const cursorViewportPos = buffer.baseY + cursorY;
185+
const viewportTop = buffer.viewportY;
186+
const viewportBottom = viewportTop + this.terminal.rows - 1;
187+
188+
if (
189+
cursorViewportPos <= viewportTop + 1 ||
190+
cursorViewportPos >= viewportBottom - 1
191+
) {
192+
const targetScroll = Math.max(
193+
0,
194+
Math.min(
195+
buffer.length - this.terminal.rows,
196+
cursorViewportPos - Math.floor(this.terminal.rows * 0.25),
197+
),
198+
);
199+
this.terminal.scrollToLine(targetScroll);
200+
}
201+
} else {
202+
// Regular resize - preserve scroll position
203+
this.preserveViewportPosition(lastKnownScrollPosition);
204+
}
175205

176206
// Update stored dimensions
177207
originalRows = size.rows;
@@ -437,8 +467,9 @@ export default class TerminalComponent {
437467
height: 100%;
438468
position: relative;
439469
background: ${this.options.theme.background};
440-
border-radius: 4px;
441470
overflow: hidden;
471+
padding: 0.25rem;
472+
box-sizing: border-box;
442473
`;
443474

444475
return this.container;
@@ -455,6 +486,9 @@ export default class TerminalComponent {
455486

456487
this.container = container;
457488

489+
// Apply terminal background color to container to match theme
490+
this.container.style.background = this.options.theme.background;
491+
458492
try {
459493
try {
460494
this.terminal.loadAddon(this.webglAddon);
@@ -535,13 +569,16 @@ export default class TerminalComponent {
535569
rows: this.terminal.rows,
536570
};
537571

538-
const response = await fetch("http://localhost:8767/terminals", {
539-
method: "POST",
540-
headers: {
541-
"Content-Type": "application/json",
572+
const response = await fetch(
573+
`http://localhost:${this.options.port}/terminals`,
574+
{
575+
method: "POST",
576+
headers: {
577+
"Content-Type": "application/json",
578+
},
579+
body: JSON.stringify(requestBody),
542580
},
543-
body: JSON.stringify(requestBody),
544-
});
581+
);
545582

546583
if (!response.ok) {
547584
throw new Error(`HTTP error! status: ${response.status}`);
@@ -573,7 +610,7 @@ export default class TerminalComponent {
573610

574611
this.pid = pid;
575612

576-
const wsUrl = `ws://localhost:8767/terminals/${pid}`;
613+
const wsUrl = `ws://localhost:${this.options.port}/terminals/${pid}`;
577614

578615
this.websocket = new WebSocket(wsUrl);
579616

@@ -627,13 +664,16 @@ export default class TerminalComponent {
627664
if (!this.pid || !this.serverMode) return;
628665

629666
try {
630-
await fetch(`http://localhost:8767/terminals/${this.pid}/resize`, {
631-
method: "POST",
632-
headers: {
633-
"Content-Type": "application/json",
667+
await fetch(
668+
`http://localhost:${this.options.port}/terminals/${this.pid}/resize`,
669+
{
670+
method: "POST",
671+
headers: {
672+
"Content-Type": "application/json",
673+
},
674+
body: JSON.stringify({ cols, rows }),
634675
},
635-
body: JSON.stringify({ cols, rows }),
636-
});
676+
);
637677
} catch (error) {
638678
console.error("Failed to resize terminal:", error);
639679
}
@@ -653,7 +693,18 @@ export default class TerminalComponent {
653693
* @param {string} data - Data to write
654694
*/
655695
write(data) {
656-
this.terminal.write(data);
696+
if (
697+
this.serverMode &&
698+
this.isConnected &&
699+
this.websocket &&
700+
this.websocket.readyState === WebSocket.OPEN
701+
) {
702+
// Send data through WebSocket instead of direct write
703+
this.websocket.send(data);
704+
} else {
705+
// For local mode or disconnected terminals, write directly
706+
this.terminal.write(data);
707+
}
657708
}
658709

659710
/**
@@ -675,6 +726,32 @@ export default class TerminalComponent {
675726
* Focus terminal
676727
*/
677728
focus() {
729+
// Ensure cursor is visible before focusing to prevent half-visibility
730+
if (this.terminal.buffer && this.terminal.buffer.active) {
731+
const buffer = this.terminal.buffer.active;
732+
const cursorY = buffer.cursorY;
733+
const cursorViewportPos = buffer.baseY + cursorY;
734+
const viewportTop = buffer.viewportY;
735+
const viewportBottom = viewportTop + this.terminal.rows - 1;
736+
737+
// Check if cursor is fully visible (with margin to prevent half-visibility)
738+
const isCursorFullyVisible =
739+
cursorViewportPos >= viewportTop + 1 &&
740+
cursorViewportPos <= viewportBottom - 2;
741+
742+
// If cursor is not fully visible, scroll to make it properly visible
743+
if (!isCursorFullyVisible && buffer.length > this.terminal.rows) {
744+
const targetScroll = Math.max(
745+
0,
746+
Math.min(
747+
buffer.length - this.terminal.rows,
748+
cursorViewportPos - Math.floor(this.terminal.rows * 0.25),
749+
),
750+
);
751+
this.terminal.scrollToLine(targetScroll);
752+
}
753+
}
754+
678755
this.terminal.focus();
679756
}
680757

@@ -896,9 +973,12 @@ export default class TerminalComponent {
896973

897974
if (this.pid && this.serverMode) {
898975
try {
899-
await fetch(`http://localhost:8767/terminals/${this.pid}/terminate`, {
900-
method: "POST",
901-
});
976+
await fetch(
977+
`http://localhost:${this.options.port}/terminals/${this.pid}/terminate`,
978+
{
979+
method: "POST",
980+
},
981+
);
902982
} catch (error) {
903983
console.error("Failed to terminate terminal:", error);
904984
}

src/components/terminal/terminalManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ class TerminalManager {
472472
background: #1e1e1e;
473473
overflow: hidden;
474474
position: relative;
475+
padding: 0.25rem;
475476
}
476477
`;
477478
}

src/components/terminal/terminalTouchSelection.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
padding: 12px 16px;
7272
border: none;
7373
background: transparent;
74-
color: #fff;
74+
color: var(--primary-text-color);
7575
font-size: 14px;
7676
font-weight: 500;
7777
text-align: center;
@@ -85,12 +85,12 @@
8585

8686
.terminal-context-menu button:hover,
8787
.terminal-context-menu button:focus {
88-
background: #616161;
88+
background: var(--popup-border-color);
8989
outline: none;
9090
}
9191

9292
.terminal-context-menu button:active {
93-
background: #757575;
93+
background: rgba(var(--secondary-color), 0.5);
9494
}
9595

9696
@media (min-width: 768px) {

0 commit comments

Comments
 (0)