diff --git a/src/backup/todo.txt b/src/backup/todo.txt index 91a9c72..5b750d0 100644 --- a/src/backup/todo.txt +++ b/src/backup/todo.txt @@ -8,7 +8,6 @@ How to go about search/replace, opening code and other considerations - For fuzzy find number of files is the problem - most likely just getting them in one place is the biggest problem that can be optimized - Opening code is problematic for large / weird files, they stall for a while, getting them buffered up is hard. And they stall the execution when they go overboard. Maybe just skipping on filesisze on something would be enough, or making a very large skip list. Another solution would be lazy loaded buffers + determining what kind of file we are dealing with on open before loading - Search everything, like fuzzy panel, on every key stroke we grep immediately and get new results, cancel old, reset -- ARENA CODE POSSIBLY DOMINATES Use session 2 - Need configs I can't change browser or vcvarsall currently, maybe syntax like :Set InternetBrowser "firefox" @@ -17,7 +16,6 @@ Use session 2 - When jumping should center the view!!! Debug session: -- Should highlight main buffer when clicking on status? - Report errorf - use coroutine dialogs - Replace in render layer also - BlockAllocator something is not working there which only showed after executing OpenCode on many files diff --git a/src/text_editor/buffer.cpp b/src/text_editor/buffer.cpp index 1963c77..8e34980 100644 --- a/src/text_editor/buffer.cpp +++ b/src/text_editor/buffer.cpp @@ -1399,9 +1399,6 @@ void InitBuffers() { EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(WorkDir, "events")); EventBuffer->no_history = true; EventBuffer->special = true; - BuildBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(WorkDir, "build")); - BuildBuffer->no_history = true; - BuildBuffer->special = true; } Int ConvertUTF8ToUTF16UnixLine(String string, char16_t *buffer, Int buffer_cap) { diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index 5fb3d05..9b5dc3c 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -398,15 +398,14 @@ BSet Exec(String cmd, String working_dir, bool set_active = true) { } BSet ExecBuild(String cmd) { + BSet build = GetBSet(BuildWindowID); BSet main = GetBSet(LastActiveLayoutWindowID); - NextActiveWindowID = main.window->id; - View *view = WindowOpenBufferView(main.window, BuildBuffer->name); - SelectRange(view, Range{}); - ResetBuffer(BuildBuffer); - Exec(view->id, false, cmd, WorkDir); // NOTE: IN CASE WE MOVE THIS TO CONSOLE WINDOW, MAKE SURE TO SWITCH HERE the scrolling - main.window->active_goto_list = view->id; + SelectRange(build.view, Range{}); + ResetBuffer(build.buffer); + Exec(build.view->id, false, cmd, WorkDir); // NOTE: IN CASE WE MOVE THIS TO CONSOLE WINDOW, MAKE SURE TO SWITCH HERE the scrolling + main.window->active_goto_list = build.view->id; main.window->goto_list_pos = 0; - return main; + return build; } void Command_SaveAll() { @@ -425,6 +424,8 @@ void Command_Build() { #else ExecBuild("sh build.sh"); #endif + BSet main = GetBSet(BuildWindowID); + main.window->visible = true; } RegisterCommand(Command_Build, "f1"); void Command_GotoNextInList() { diff --git a/src/text_editor/globals.cpp b/src/text_editor/globals.cpp index b2ba2d7..d11c259 100644 --- a/src/text_editor/globals.cpp +++ b/src/text_editor/globals.cpp @@ -27,12 +27,14 @@ WindowID NullWindowID; WindowID DebugWindowID; ViewID DebugViewID; BufferID DebugBufferID; - WindowID CommandWindowID; WindowID StatusBarWindowID; WindowID SearchWindowID; ViewID SearchViewID; BufferID SearchBufferID; +WindowID BuildWindowID; +ViewID BuildViewID; +BufferID BuildBufferID; WindowID NextActiveWindowID; WindowID ActiveWindowID; @@ -43,7 +45,6 @@ WindowID ResizerSelected = {-1}; WindowID ResizerHover = {-1}; Caret DocumentAnchor; -Buffer *BuildBuffer; Buffer *GCInfoBuffer; Buffer *EventBuffer; Buffer *TraceBuffer; diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 5abbb49..c2a19d8 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -31,6 +31,7 @@ #include "window_debug.cpp" #include "window_status.cpp" #include "window_search.cpp" +#include "window_build.cpp" #include "process.cpp" #include "event.cpp" diff --git a/src/text_editor/window.cpp b/src/text_editor/window.cpp index 24a8b19..80aebb5 100644 --- a/src/text_editor/window.cpp +++ b/src/text_editor/window.cpp @@ -122,6 +122,7 @@ void InitWindows() { StatusWindowInit(); DebugWindowInit(); SearchWindowInit(); + BuildWindowInit(); } void CalcNiceties(Window *n) { @@ -152,6 +153,7 @@ void LayoutWindows(int16_t wx, int16_t wy) { StatusWindowLayout(&screen_rect, wx, wy); DebugWindowLayout(&screen_rect, wx, wy); SearchWindowLayout(&screen_rect, wx, wy); + BuildWindowLayout(&screen_rect, wx, wy); // Column layout Int c = 0; diff --git a/src/text_editor/window.h b/src/text_editor/window.h index ee4748e..a38688d 100644 --- a/src/text_editor/window.h +++ b/src/text_editor/window.h @@ -63,3 +63,6 @@ void StatusWindowLayout(Rect2I *rect, Int wx, Int wy); void DebugWindowInit(); void DebugWindowLayout(Rect2I *rect, Int wx, Int wy); + +void BuildWindowInit(); +void BuildWindowLayout(Rect2I *rect, Int wx, Int wy); diff --git a/src/text_editor/window_build.cpp b/src/text_editor/window_build.cpp new file mode 100644 index 0000000..2ea0402 --- /dev/null +++ b/src/text_editor/window_build.cpp @@ -0,0 +1,36 @@ +void BuildWindowInit() { + Window *window = CreateWind(); + BuildWindowID = window->id; + Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(WorkDir, "build")); + buffer->special = true; + buffer->no_history = true; + BuildBufferID = buffer->id; + View *view = CreateView(buffer->id); + view->special = true; + BuildViewID = view->id; + window->active_view = view->id; + window->draw_darker = true; + window->draw_line_highlight = true; + window->layout = false; + window->visible = false; + window->lose_visibility_on_escape = true; + window->jump_history = false; +} + +void BuildWindowLayout(Rect2I *rect, Int wx, Int wy) { + Window *n = GetWindow(BuildWindowID); + Rect2I copy_rect = *rect; + if (!n->visible) { + rect = ©_rect; + } + Int barsize = n->font->line_spacing * 10; + n->document_rect = n->total_rect = CutBottom(rect, barsize); +} + +void Command_ShowBuildWindow() { + if (ActiveWindowID != BuildWindowID) { + return; + } + BSet main = GetBSet(BuildWindowID); + main.window->visible = true; +} RegisterCommand(Command_ShowBuildWindow, "ctrl-grave"); \ No newline at end of file diff --git a/src/text_editor/window_command.cpp b/src/text_editor/window_command.cpp index 4739f75..7407146 100644 --- a/src/text_editor/window_command.cpp +++ b/src/text_editor/window_command.cpp @@ -65,7 +65,6 @@ Array FuzzySearchLines(Allocator allocator, Buffer *buffer, Int line_ int32_t rating = FuzzyRate(s, needle); Add(&ratings, {(int32_t)i, rating}); } - Array temp = Copy(allocator, ratings); MergeSort(ratings.len, ratings.data, temp.data); return ratings;