diff --git a/src/backup/todo.txt b/src/backup/todo.txt index 1b0f038..c96daea 100644 --- a/src/backup/todo.txt +++ b/src/backup/todo.txt @@ -7,7 +7,7 @@ - Window position: vscode opens in fullscreen and then remembers what position it was close in (could be a config option) - On Linux: Try to implement is_debugger_present() - Maybe IPC for te.exe when it's already open and file arguments are passed it should perhaps open a buffer in current window?? -- Add <> <> template strings to Open (Then remove SEtWorkdirhere) +- Add <> <> template strings to Open (Then remove SEtWorkdirhere) - :Set Filename to name current buffer ??? :O and others like that!! - Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep) - Make the equivalent of SearchOpenBuffers but for cmds like !@git grep -n "@>" diff --git a/src/text_editor/globals.cpp b/src/text_editor/globals.cpp index baae7ad..00d49ff 100644 --- a/src/text_editor/globals.cpp +++ b/src/text_editor/globals.cpp @@ -179,7 +179,7 @@ RegisterVariable(Int, TrimTrailingWhitespace, 1); // PROJECT_MANAGEMENT // Set at the beginning of the program to current directory -RegisterVariable(String, ProjectDirectory, ""); +RegisterVariable(String, ProjectFolder, ""); // PLUGIN_BUILD_WINDOW RegisterVariable(String, Build1OnWindows, "build.bat slow"); diff --git a/src/text_editor/plugin_build_window.cpp b/src/text_editor/plugin_build_window.cpp index 4f87e6f..490717a 100644 --- a/src/text_editor/plugin_build_window.cpp +++ b/src/text_editor/plugin_build_window.cpp @@ -5,7 +5,7 @@ BufferID BuildBufferID; void InitBuildWindow() { Window *window = CreateWind(); BuildWindowID = window->id; - Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "build")); + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "build")); buffer->special = true; buffer->no_history = true; BuildBufferID = buffer->id; @@ -32,7 +32,7 @@ void LayoutBuildWindow(Rect2I *rect, int16_t wx, int16_t wy) { window->document_rect = window->total_rect = CutBottom(rect, barsize); } -BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = ProjectDirectory) { +BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = ProjectFolder) { SaveAll(); Scratch scratch; BSet build = GetBSet(BuildWindowID); diff --git a/src/text_editor/plugin_command_window.cpp b/src/text_editor/plugin_command_window.cpp index 0b192fb..42ff191 100644 --- a/src/text_editor/plugin_command_window.cpp +++ b/src/text_editor/plugin_command_window.cpp @@ -67,7 +67,7 @@ void LayoutCommandWindow(Rect2I *rect, int16_t wx, int16_t wy) { void InitCommandWindow() { Window *window = CreateWind(); CommandWindowID = window->id; - Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "command_bar")); + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "command_bar")); buffer->special = true; buffer->no_history = true; View *view = CreateView(buffer->id); diff --git a/src/text_editor/plugin_config.cpp b/src/text_editor/plugin_config.cpp index 45d1acb..7443538 100644 --- a/src/text_editor/plugin_config.cpp +++ b/src/text_editor/plugin_config.cpp @@ -117,8 +117,8 @@ void Set(String string) { } #if PLUGIN_PROJECT_MANAGEMENT - if (name == "ProjectDirectory") { - SetProjectDirectory(*var->string); + if (name == "ProjectFolder") { + SetProjectFolder(*var->string); } #endif return; diff --git a/src/text_editor/plugin_debug_window.cpp b/src/text_editor/plugin_debug_window.cpp index 4e31d86..f5356b7 100644 --- a/src/text_editor/plugin_debug_window.cpp +++ b/src/text_editor/plugin_debug_window.cpp @@ -12,7 +12,7 @@ void InitDebugWindow() { window->primary = false; window->jump_history = false; - Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "debug")); + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "debug")); DebugBufferID = buffer->id; buffer->no_history = true; buffer->special = true; diff --git a/src/text_editor/plugin_load_vcvars.cpp b/src/text_editor/plugin_load_vcvars.cpp index 6d40d62..38bf55a 100644 --- a/src/text_editor/plugin_load_vcvars.cpp +++ b/src/text_editor/plugin_load_vcvars.cpp @@ -2,7 +2,7 @@ void Windows_SetupVCVarsall(mco_coro *co) { View *view = NULL; { Scratch scratch; - String working_dir = ProjectDirectory; + String working_dir = ProjectFolder; String buffer_name = GetUniqueBufferName(working_dir, "vcvarsall-"); String cmd = Format(scratch, "\"%S\" && set", VCVarsPath); view = OpenBufferView(buffer_name); diff --git a/src/text_editor/plugin_project_management.cpp b/src/text_editor/plugin_project_management.cpp index 5ad1457..a71cb85 100644 --- a/src/text_editor/plugin_project_management.cpp +++ b/src/text_editor/plugin_project_management.cpp @@ -1,5 +1,5 @@ -void SetProjectDirectory(String dir) { - ProjectDirectory = Intern(&GlobalInternTable, dir); +void SetProjectFolder(String dir) { + ProjectFolder = Intern(&GlobalInternTable, dir); Scratch scratch; For (Buffers) { if (it->special) { @@ -14,7 +14,7 @@ void CO_OpenCode(mco_coro *co) { Array patterns = SplitWhitespace(ctx->arena, OpenCodePatterns); Array exclude_patterns = SplitWhitespace(ctx->arena, OpenCodeExcludePatterns); Array dirs = {ctx->arena}; - Add(&dirs, Copy(ctx->arena, ProjectDirectory)); + Add(&dirs, Copy(ctx->arena, ProjectFolder)); for (int diri = 0; diri < dirs.len; diri += 1) { for (FileIter it = IterateFiles(ctx->arena, dirs[diri]); IsValid(it); Advance(&it)) { bool should_open = true; @@ -52,12 +52,12 @@ void CO_OpenCode(mco_coro *co) { } RegisterCoroutineCommand( CO_OpenCode, "", - "Open all code files in current ProjectDirectory, the code files are determined through NonCodePatterns_EndsWith config variable list", + "Open all code files in current ProjectFolder, the code files are determined through NonCodePatterns_EndsWith config variable list", data->dont_wait_until_resolved = true; ); void OpenProject(String directory) { - SetProjectDirectory(directory); + SetProjectFolder(directory); #if PLUGIN_CONFIG Scratch scratch; for (FileIter it = IterateFiles(scratch, directory); IsValid(it); Advance(&it)) { @@ -111,7 +111,7 @@ void CO_CreateProject(mco_coro *co) { String src_dir = Format(scratch, "%S/src", project_dir); MakeDir(project_dir); MakeDir(src_dir); - SetProjectDirectory(project_dir); + SetProjectFolder(project_dir); Buffer *project = BufferOpenFile(Format(scratch, "%S/project.te", project_dir)); RawAppendf(project, ":OpenCode\n:Set BinaryUnderDebug '%S/build/main.exe'\n", project_dir); diff --git a/src/text_editor/plugin_project_management.h b/src/text_editor/plugin_project_management.h index 5b33c27..98e07f9 100644 --- a/src/text_editor/plugin_project_management.h +++ b/src/text_editor/plugin_project_management.h @@ -1 +1 @@ -void SetProjectDirectory(String name); +void SetProjectFolder(String name); diff --git a/src/text_editor/plugin_remedybg.cpp b/src/text_editor/plugin_remedybg.cpp index 66798ae..3224b56 100644 --- a/src/text_editor/plugin_remedybg.cpp +++ b/src/text_editor/plugin_remedybg.cpp @@ -2124,7 +2124,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) { if (file.len == 0) { Scratch scratch; - for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) { + for (FileIter it = IterateFiles(scratch, ProjectFolder); IsValid(it); Advance(&it)) { if (EndsWith(it.filename, ".rdbg")) { file = Intern(&GlobalInternTable, it.absolute_path); break; @@ -2178,7 +2178,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) { rdbg_Id cfg_id; char *exe = file.data; char *args = NULL; - char *work_dir = ProjectDirectory.data; + char *work_dir = ProjectFolder.data; char *env = NULL; AddSessionConfig(&RDBG_Ctx, exe, args, work_dir, env, true, true, &res, &cfg_id); if (ContextHadError(&RDBG_Ctx)) { diff --git a/src/text_editor/plugin_search_window.cpp b/src/text_editor/plugin_search_window.cpp index 30e0fb2..5294492 100644 --- a/src/text_editor/plugin_search_window.cpp +++ b/src/text_editor/plugin_search_window.cpp @@ -63,7 +63,7 @@ void CMD_ToggleSearchWordBoundary() { void InitSearchWindow() { Window *window = CreateWind(); SearchWindowID = window->id; - Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "search")); + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "search")); buffer->special = true; SearchBufferID = buffer->id; View *view = CreateView(buffer->id); diff --git a/src/text_editor/plugin_status_window.cpp b/src/text_editor/plugin_status_window.cpp index c623025..c61a3df 100644 --- a/src/text_editor/plugin_status_window.cpp +++ b/src/text_editor/plugin_status_window.cpp @@ -3,7 +3,7 @@ WindowID StatusWindowID; void InitStatusWindow() { Window *window = CreateWind(); StatusWindowID = window->id; - Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "status_bar")); + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "status_bar")); buffer->special = true; View *view = CreateView(buffer->id); view->special = true; diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 579d41c..4312404 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -861,7 +861,7 @@ int main(int argc, char **argv) #endif InitScratch(); InitOS(ReportErrorf); - ProjectDirectory = GetWorkingDir(Perm); + ProjectFolder = GetWorkingDir(Perm); #if OS_WINDOWS { wchar_t *p = GetEnvironmentStringsW(); @@ -978,13 +978,13 @@ int main(int argc, char **argv) { Allocator sys_allocator = GetSystemAllocator(); Scratch scratch; - Buffer *null_buffer = CreateBuffer(sys_allocator, Format(scratch, "%S/scratch", ProjectDirectory)); + Buffer *null_buffer = CreateBuffer(sys_allocator, Format(scratch, "%S/scratch", ProjectFolder)); null_buffer->special = true; View *null_view = CreateView(null_buffer->id); null_view->special = true; Assert(null_buffer->id == NullBufferID && null_view->id == NullViewID); - Buffer *logs_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "logs", "")); + Buffer *logs_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "logs", "")); logs_buffer->special = true; View *logs_view = CreateView(logs_buffer->id); logs_view->special = true; @@ -992,13 +992,13 @@ int main(int argc, char **argv) LogView = logs_view; #if PLUGIN_RECORD_GC - GCInfoBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "gc")); + GCInfoBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "gc")); GCInfoBuffer->special = true; GCInfoBuffer->no_history = true; #endif #if PLUGIN_RECORD_EVENTS - EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "events")); + EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "events")); EventBuffer->no_history = true; EventBuffer->special = true; #endif diff --git a/src/text_editor/ui.cpp b/src/text_editor/ui.cpp index 251166f..3fb98c7 100644 --- a/src/text_editor/ui.cpp +++ b/src/text_editor/ui.cpp @@ -291,8 +291,8 @@ String InsertVariables(Allocator allocator, String string) { void TestInsertVariable() { Scratch scratch; - String a = "Thing/@(ProjectDirectory)/Another"; - String b = "Thing/@ProjectDirectory/Another"; + String a = "Thing/@(ProjectFolder)/Another"; + String b = "Thing/@ProjectFolder/Another"; Assert(InsertVariables(scratch, a) == InsertVariables(scratch, b)); int c = 10; @@ -301,8 +301,8 @@ void TestInsertVariable() { /* Variables: - @ProjectDirectory/build/te - @(ProjectDirectory)/build/te + @ProjectFolder/build/te + @(ProjectFolder)/build/te Start of string matchers: ! Execute with default shell @@ -315,7 +315,7 @@ Start of string matchers: py: @todo, execute in python shell, this will use the python3 shell and pass the rest to it's stdin or maybe as a file More comprehensive syntax for commands: - !{/usr/bin/python,Hidden,Input:Clipboard,Output:Clipboard,WorkingDirectory:@ProjectDirectory,Env:{Thing:asd}} + !{/usr/bin/python,Hidden,Input:Clipboard,Output:Clipboard,WorkingDirectory:@ProjectFolder,Env:{Thing:asd}} Otherwise it does filepath parsing: C:/windows/path