mirror of https://github.com/adamdruppe/arsd.git
some bug fixes
This commit is contained in:
parent
8da8d51a86
commit
cea860a447
|
|
@ -98,6 +98,7 @@ import arsd.rtf;
|
||||||
// import arsd.screen; // D1 or 2.098
|
// import arsd.screen; // D1 or 2.098
|
||||||
import arsd.script;
|
import arsd.script;
|
||||||
import arsd.sha;
|
import arsd.sha;
|
||||||
|
import arsd.shell;
|
||||||
import arsd.simpleaudio;
|
import arsd.simpleaudio;
|
||||||
import arsd.simpledisplay;
|
import arsd.simpledisplay;
|
||||||
import arsd.sqlite;
|
import arsd.sqlite;
|
||||||
|
|
|
||||||
14
minigui.d
14
minigui.d
|
|
@ -17879,15 +17879,26 @@ class FilePicker : Dialog {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
enum specialZoneSize = 1;
|
enum specialZoneSize = 1;
|
||||||
|
string originalString = whole;
|
||||||
|
bool fallback;
|
||||||
|
|
||||||
|
start_over:
|
||||||
|
|
||||||
char current = whole[0];
|
char current = whole[0];
|
||||||
if(current >= '0' && current <= '9') {
|
if(!fallback && current >= '0' && current <= '9') {
|
||||||
|
// if this overflows, it can mess up the sort, so it will fallback to string sort in that event
|
||||||
int accumulator;
|
int accumulator;
|
||||||
do {
|
do {
|
||||||
|
auto before = accumulator;
|
||||||
whole = whole[1 .. $];
|
whole = whole[1 .. $];
|
||||||
accumulator *= 10;
|
accumulator *= 10;
|
||||||
accumulator += current - '0';
|
accumulator += current - '0';
|
||||||
current = whole.length ? whole[0] : 0;
|
current = whole.length ? whole[0] : 0;
|
||||||
|
if(accumulator < before) {
|
||||||
|
fallback = true;
|
||||||
|
whole = originalString;
|
||||||
|
goto start_over;
|
||||||
|
}
|
||||||
} while (current >= '0' && current <= '9');
|
} while (current >= '0' && current <= '9');
|
||||||
|
|
||||||
return accumulator + specialZoneSize + cast(int) char.max; // leave room for symbols
|
return accumulator + specialZoneSize + cast(int) char.max; // leave room for symbols
|
||||||
|
|
@ -18277,6 +18288,7 @@ private FileType getFileType(string name) {
|
||||||
auto ret = stat((name ~ '\0').ptr, &buf);
|
auto ret = stat((name ~ '\0').ptr, &buf);
|
||||||
if(ret == -1)
|
if(ret == -1)
|
||||||
return FileType.error;
|
return FileType.error;
|
||||||
|
// FIXME: what about a symlink to a dir? S_IFLNK then readlink then i believe stat it again.
|
||||||
return ((buf.st_mode & S_IFMT) == S_IFDIR) ? FileType.dir : FileType.other;
|
return ((buf.st_mode & S_IFMT) == S_IFDIR) ? FileType.dir : FileType.other;
|
||||||
} else assert(0, "Not implemented");
|
} else assert(0, "Not implemented");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
57
shell.d
57
shell.d
|
|
@ -10,6 +10,49 @@
|
||||||
|
|
||||||
History:
|
History:
|
||||||
Added October 18, 2025
|
Added October 18, 2025
|
||||||
|
|
||||||
|
Bugs:
|
||||||
|
$(LIST
|
||||||
|
* < and > redirections are not implemented at all
|
||||||
|
* >> not implemented
|
||||||
|
* | on Windows is not implemented
|
||||||
|
* glob expansion is minimal - * works, but no ?, no {item,other}, no {start..end}
|
||||||
|
* ~ expansion is not implemented
|
||||||
|
* `substitution` and $(...) is not implemented
|
||||||
|
* variable expansion is not implemented. can do $IDENT and ${IDENT} i think
|
||||||
|
* built-ins don't exist - `set`, want `for` and then like `export` and a way to hook in basic utilities polyfills especially on Windows (ls, rm, grep, etc)
|
||||||
|
* built-ins should have a pipe they can read/write to and return an int. integrate with arsd.cli?
|
||||||
|
* no !history recall. or history command in general
|
||||||
|
* job control is rudimentary - no fg, bg, jobs, &, ctrl+z, etc.
|
||||||
|
* set -o ignoreeof
|
||||||
|
* the path search is hardcoded
|
||||||
|
* prompt could be cooler
|
||||||
|
PS1 = normal prompt
|
||||||
|
PS2 = continuation prompt
|
||||||
|
Bash shell executes the content of the PROMPT_COMMAND just before displaying the PS1 variable.
|
||||||
|
|
||||||
|
bash does it with `\u` and stuff but i kinda thiink using `$USER` and such might make more sense.
|
||||||
|
* it prints command return values when you might not want that
|
||||||
|
* LS_COLORS env var is not set
|
||||||
|
* && and || is not implemented
|
||||||
|
* the api is not very good
|
||||||
|
* ulimit? sourcing things too. aliases.
|
||||||
|
* see my bash rc for other little things. maybe i want a deeshrc
|
||||||
|
* permission denied when hitting tab on Windows
|
||||||
|
* tab complete of available commands not implemented - get it from path search.
|
||||||
|
* some vars dynamic like $_ being the most recent command, $? being its return value, etc
|
||||||
|
)
|
||||||
|
|
||||||
|
Questionable_ideas:
|
||||||
|
$(LIST
|
||||||
|
* separate stdout and stderr more by default, allow stderr pipes.
|
||||||
|
* custom completion scripts? prolly not bash compatible since the scripts would be more involved
|
||||||
|
* some kind of scriptable cmdlet? a full on script language with shell stuff embeddable?
|
||||||
|
see https://hush-shell.github.io/cmd/index.html for some ok ideas
|
||||||
|
* do something fun with job control. idk what tho really.
|
||||||
|
* can terminal emulators get notifications when the foreground process group changes? i don't think so but i could make a "poll again now" sequence since i control shell and possibly terminal emulator now.
|
||||||
|
* change DISPLAY and such when attaching remote sessions
|
||||||
|
)
|
||||||
+/
|
+/
|
||||||
module arsd.shell;
|
module arsd.shell;
|
||||||
|
|
||||||
|
|
@ -424,6 +467,12 @@ ShellCommand[] parseShellCommand(ShellLexeme[] lexemes, ShellContext context, Gl
|
||||||
ShellCommand currentCommand;
|
ShellCommand currentCommand;
|
||||||
ShellCommand firstCommand;
|
ShellCommand firstCommand;
|
||||||
|
|
||||||
|
enum ParseState {
|
||||||
|
lookingForVarAssignment,
|
||||||
|
lookingForArg,
|
||||||
|
}
|
||||||
|
ParseState parseState = ParseState.lookingForVarAssignment;
|
||||||
|
|
||||||
while(lexemes.length) {
|
while(lexemes.length) {
|
||||||
auto component = nextComponent(lexemes);
|
auto component = nextComponent(lexemes);
|
||||||
if(component.length) {
|
if(component.length) {
|
||||||
|
|
@ -451,12 +500,6 @@ ShellCommand[] parseShellCommand(ShellLexeme[] lexemes, ShellContext context, Gl
|
||||||
BUT THIS IS MY SHELL I CAN DO WHAT I WANT!!!!!!!!!!!!
|
BUT THIS IS MY SHELL I CAN DO WHAT I WANT!!!!!!!!!!!!
|
||||||
+/
|
+/
|
||||||
|
|
||||||
enum ParseState {
|
|
||||||
lookingForVarAssignment,
|
|
||||||
lookingForArg,
|
|
||||||
}
|
|
||||||
ParseState parseState = ParseState.lookingForVarAssignment;
|
|
||||||
|
|
||||||
bool thisWasEnvironmentPair = false;
|
bool thisWasEnvironmentPair = false;
|
||||||
EnvironmentPair environmentPair;
|
EnvironmentPair environmentPair;
|
||||||
bool thisWasRedirection = false;
|
bool thisWasRedirection = false;
|
||||||
|
|
@ -718,7 +761,7 @@ class Shell {
|
||||||
auto commands = parseShellCommand(lexShellCommandLine(commandLine), context, &globberForwarder);
|
auto commands = parseShellCommand(lexShellCommandLine(commandLine), context, &globberForwarder);
|
||||||
foreach(command; commands)
|
foreach(command; commands)
|
||||||
try {
|
try {
|
||||||
//dumpCommand(command);
|
dumpCommand(command);
|
||||||
|
|
||||||
version(Posix) {
|
version(Posix) {
|
||||||
import core.sys.posix.unistd;
|
import core.sys.posix.unistd;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue