Open dir, small fixes

This commit is contained in:
Krzosa Karol
2025-12-27 21:37:41 +01:00
parent 28d8348b89
commit 1011c63494
5 changed files with 24 additions and 13 deletions

View File

@@ -1,6 +1,14 @@
- What precise workflow do I need for me to be viable to use this?
- From a user (novice) point of view, how does it look like?
Use session 1:
- OpenCommand in command window freezes the app
- Shift + backspace should delete normally
- SDL popups are not working on linux ...
- Creating files more efficiently
- Dialog popup on save? Or ctrl-shift-s?
- Maybe rename in bar and do :Rename
- Open with seek string (open at pattern) filename:32 filename:/^Window$/
- build console window
- Show what process/coroutines are running and allow to kill (active process buffer?)
@@ -11,6 +19,8 @@
- Why constraint that name of buffer needs to be unique? For Open() and default behavior but is this required?
- Try to add Tracking Allocator and rewrite the app, free all memory at the end of the app and check all is well
- Maybe fix OS layer returning with "/" at the end for directories
- Fix open code pattern
Commands TODO:
- Console: OK concept but constrain

View File

@@ -293,11 +293,8 @@ API Process SpawnProcess(String command_line, String working_dir, String write_s
const int PIPE_WRITE = 1;
bool error = false;
char *buffer = AllocArray(scratch, char, 4096);
working_dir = Copy(scratch, working_dir);
chdir(working_dir.data);
getcwd(buffer, 4096);
defer { chdir(buffer); };
Process process = {};
UnixProcess *plat = (UnixProcess *)&process.platform;

View File

@@ -1435,7 +1435,7 @@ String GetUniqueBufferName(String working_dir, String prepend_name, String exten
void InitBuffers() {
Allocator sys_allocator = GetSystemAllocator();
Scratch scratch;
Buffer *null_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(GetWorkingDir(scratch), "console"));
Buffer *null_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(WorkDir, "console"));
null_buffer->special = true;
View *null_view = CreateView(null_buffer->id);
null_view->special = true;

View File

@@ -454,7 +454,7 @@ void Command_Build() {
#if OS_WINDOWS
ExecBuild("build.bat");
#else
ExecBuild("./build.sh");
ExecBuild("sh build.sh");
#endif
} RegisterCommand(Command_Build, "f1");
@@ -701,10 +701,10 @@ void Command_ToggleFullscreen() {
void Command_SetWorkDir() {
BSet main = GetBSet(LastActiveLayoutWindowID);
WorkDir = ChopLastSlash(main.buffer->name);
WorkDir = GetDir(main.buffer);
} RegisterCommand(Command_SetWorkDir, "");
String CodeSkipEndings[] = {".git" };
String CodeSkipPatterns[] = {".git/"};
String Coro_OpenCodeDir;
void Coro_OpenCode(mco_coro *co) {
@@ -714,16 +714,15 @@ void Coro_OpenCode(mco_coro *co) {
int i = 0;
for (int diri = 0; diri < dirs.len; diri += 1) {
for (FileIter it = IterateFiles(arena, dirs[diri]); IsValid(it); Advance(&it)) {
bool match = false;
for (int endings_i = 0; endings_i < Lengthof(CodeSkipEndings); endings_i += 1) {
String ending = CodeSkipEndings[endings_i];
for (int endings_i = 0; endings_i < Lengthof(CodeSkipPatterns); endings_i += 1) {
String ending = CodeSkipPatterns[endings_i];
if (EndsWith(it.absolute_path, ending)) {
match = true;
break;
}
}
if (match) break;
if (match) continue;
if (it.is_directory) {

View File

@@ -796,8 +796,13 @@ int main(int argc, char **argv)
if (it == "--testing") {
Testing = true;
} else if (IsDir(it)) {
WorkDir = GetAbsolutePath(Perm, it);
OpenCode(WorkDir);
} else {
if (!FileExists(it)) continue;
if (!FileExists(it)) {
continue;
}
Window *window = GetWindow({0});
WindowOpenBufferView(window, it);
}