Open dir, small fixes
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
- What precise workflow do I need for me to be viable to use this?
|
- 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?
|
- 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$/
|
- Open with seek string (open at pattern) filename:32 filename:/^Window$/
|
||||||
- build console window
|
- build console window
|
||||||
- Show what process/coroutines are running and allow to kill (active process buffer?)
|
- 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?
|
- 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
|
- 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:
|
Commands TODO:
|
||||||
- Console: OK concept but constrain
|
- Console: OK concept but constrain
|
||||||
|
|||||||
@@ -293,11 +293,8 @@ API Process SpawnProcess(String command_line, String working_dir, String write_s
|
|||||||
const int PIPE_WRITE = 1;
|
const int PIPE_WRITE = 1;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
char *buffer = AllocArray(scratch, char, 4096);
|
working_dir = Copy(scratch, working_dir);
|
||||||
chdir(working_dir.data);
|
chdir(working_dir.data);
|
||||||
getcwd(buffer, 4096);
|
|
||||||
defer { chdir(buffer); };
|
|
||||||
|
|
||||||
|
|
||||||
Process process = {};
|
Process process = {};
|
||||||
UnixProcess *plat = (UnixProcess *)&process.platform;
|
UnixProcess *plat = (UnixProcess *)&process.platform;
|
||||||
|
|||||||
@@ -1435,7 +1435,7 @@ String GetUniqueBufferName(String working_dir, String prepend_name, String exten
|
|||||||
void InitBuffers() {
|
void InitBuffers() {
|
||||||
Allocator sys_allocator = GetSystemAllocator();
|
Allocator sys_allocator = GetSystemAllocator();
|
||||||
Scratch scratch;
|
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;
|
null_buffer->special = true;
|
||||||
View *null_view = CreateView(null_buffer->id);
|
View *null_view = CreateView(null_buffer->id);
|
||||||
null_view->special = true;
|
null_view->special = true;
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ void Command_Build() {
|
|||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
ExecBuild("build.bat");
|
ExecBuild("build.bat");
|
||||||
#else
|
#else
|
||||||
ExecBuild("./build.sh");
|
ExecBuild("sh build.sh");
|
||||||
#endif
|
#endif
|
||||||
} RegisterCommand(Command_Build, "f1");
|
} RegisterCommand(Command_Build, "f1");
|
||||||
|
|
||||||
@@ -701,10 +701,10 @@ void Command_ToggleFullscreen() {
|
|||||||
|
|
||||||
void Command_SetWorkDir() {
|
void Command_SetWorkDir() {
|
||||||
BSet main = GetBSet(LastActiveLayoutWindowID);
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
WorkDir = ChopLastSlash(main.buffer->name);
|
WorkDir = GetDir(main.buffer);
|
||||||
} RegisterCommand(Command_SetWorkDir, "");
|
} RegisterCommand(Command_SetWorkDir, "");
|
||||||
|
|
||||||
String CodeSkipEndings[] = {".git" };
|
String CodeSkipPatterns[] = {".git/"};
|
||||||
String Coro_OpenCodeDir;
|
String Coro_OpenCodeDir;
|
||||||
|
|
||||||
void Coro_OpenCode(mco_coro *co) {
|
void Coro_OpenCode(mco_coro *co) {
|
||||||
@@ -714,16 +714,15 @@ void Coro_OpenCode(mco_coro *co) {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (int diri = 0; diri < dirs.len; diri += 1) {
|
for (int diri = 0; diri < dirs.len; diri += 1) {
|
||||||
for (FileIter it = IterateFiles(arena, dirs[diri]); IsValid(it); Advance(&it)) {
|
for (FileIter it = IterateFiles(arena, dirs[diri]); IsValid(it); Advance(&it)) {
|
||||||
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
for (int endings_i = 0; endings_i < Lengthof(CodeSkipEndings); endings_i += 1) {
|
for (int endings_i = 0; endings_i < Lengthof(CodeSkipPatterns); endings_i += 1) {
|
||||||
String ending = CodeSkipEndings[endings_i];
|
String ending = CodeSkipPatterns[endings_i];
|
||||||
if (EndsWith(it.absolute_path, ending)) {
|
if (EndsWith(it.absolute_path, ending)) {
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (match) break;
|
if (match) continue;
|
||||||
|
|
||||||
|
|
||||||
if (it.is_directory) {
|
if (it.is_directory) {
|
||||||
|
|||||||
@@ -796,8 +796,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (it == "--testing") {
|
if (it == "--testing") {
|
||||||
Testing = true;
|
Testing = true;
|
||||||
|
} else if (IsDir(it)) {
|
||||||
|
WorkDir = GetAbsolutePath(Perm, it);
|
||||||
|
OpenCode(WorkDir);
|
||||||
} else {
|
} else {
|
||||||
if (!FileExists(it)) continue;
|
if (!FileExists(it)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Window *window = GetWindow({0});
|
Window *window = GetWindow({0});
|
||||||
WindowOpenBufferView(window, it);
|
WindowOpenBufferView(window, it);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user