feat: complete command completion in shell

This commit is contained in:
2026-06-18 07:56:00 +02:00
parent 0b9ecf0bb0
commit 580a95348a
2 changed files with 19 additions and 9 deletions
+1 -1
View File
@@ -12,4 +12,4 @@
#pragma once
#define MONTAUK_BUILD_NUMBER 108
#define MONTAUK_BUILD_NUMBER 110
+10
View File
@@ -441,6 +441,15 @@ extern "C" void _start() {
char* table[128] = { };
int n = get_completions(line, table, 128, cwd, current_drive);
// Command completion if there is only 1 match
if (n == 1) {
size_t chars_already_typed = pos;
pos = 0;
montauk::strncpy(line, table[0], 256);
pos = montauk::slen(table[0]);
montauk::print(table[0] + chars_already_typed);
} else { // If more than one result, print multiple results
montauk::print("\n");
for (int i = 0; i < n; i++) {
montauk::print(" ");
@@ -450,6 +459,7 @@ extern "C" void _start() {
pos = 0;
prompt();
}
continue;
}