Add build window
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
36
src/text_editor/window_build.cpp
Normal file
36
src/text_editor/window_build.cpp
Normal file
@@ -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");
|
||||
@@ -65,7 +65,6 @@ Array<FuzzyPair> FuzzySearchLines(Allocator allocator, Buffer *buffer, Int line_
|
||||
int32_t rating = FuzzyRate(s, needle);
|
||||
Add(&ratings, {(int32_t)i, rating});
|
||||
}
|
||||
|
||||
Array<FuzzyPair> temp = Copy(allocator, ratings);
|
||||
MergeSort(ratings.len, ratings.data, temp.data);
|
||||
return ratings;
|
||||
|
||||
Reference in New Issue
Block a user