Build panel and reworking Open paths, not compiling
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
- 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?
|
||||||
|
|
||||||
|
- build console window
|
||||||
|
- Use WorkDir (raname to Workspace?) to shorten file names
|
||||||
- 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?)
|
||||||
- ctrl + p like in VSCode (without special buffers)
|
|
||||||
- Maybe 2 windows?
|
|
||||||
- Database idea: use special buffers to store information
|
- Database idea: use special buffers to store information
|
||||||
- Editing the buffer doesn't seem to be the slow part rather, accessing the data and putting it into the buffer (potentially hitting many different memory locations) I have a crazy idea to use buffers in order to store the names in a serialized format
|
- Editing the buffer doesn't seem to be the slow part rather, accessing the data and putting it into the buffer (potentially hitting many different memory locations) I have a crazy idea to use buffers in order to store the names in a serialized format
|
||||||
- non editable buffers (raw ops ok, non-raw no op)
|
- non editable buffers (raw ops ok, non-raw no op)
|
||||||
|
|||||||
@@ -84,6 +84,13 @@ API String GetPrefix(String a, int64_t len) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API char At(String a, int64_t idx) {
|
||||||
|
if (idx < a.len) {
|
||||||
|
return a.data[idx];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
API String GetSlice(String arr, int64_t first_index, int64_t one_past_last_index) {
|
API String GetSlice(String arr, int64_t first_index, int64_t one_past_last_index) {
|
||||||
// Negative indexes work in python style, they return you the index counting from end of list
|
// Negative indexes work in python style, they return you the index counting from end of list
|
||||||
if (one_past_last_index == SLICE_LAST) one_past_last_index = arr.len;
|
if (one_past_last_index == SLICE_LAST) one_past_last_index = arr.len;
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ API bool IsParen(char16_t c) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
API String16 Chop(String16 a, int64_t len) {
|
API String16 Chop(String16 a, int64_t len) {
|
||||||
len = ClampTop(len, a.len);
|
len = ClampTop(len, a.len);
|
||||||
String16 result = {a.data, a.len - len};
|
String16 result = {a.data, a.len - len};
|
||||||
@@ -95,6 +94,13 @@ API String16 GetPrefix(String16 a, int64_t len) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API char16_t At(String16 a, int64_t idx) {
|
||||||
|
if (idx < a.len) {
|
||||||
|
return a.data[idx];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
API String16 GetSlice(String16 arr, int64_t first_index, int64_t one_past_last_index) {
|
API String16 GetSlice(String16 arr, int64_t first_index, int64_t one_past_last_index) {
|
||||||
// Negative indexes work in python style, they return you the index counting from end of list
|
// Negative indexes work in python style, they return you the index counting from end of list
|
||||||
if (one_past_last_index == SLICE_LAST) one_past_last_index = arr.len;
|
if (one_past_last_index == SLICE_LAST) one_past_last_index = arr.len;
|
||||||
|
|||||||
@@ -1437,6 +1437,9 @@ void InitBuffers() {
|
|||||||
EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(WorkDir, "events"));
|
EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(WorkDir, "events"));
|
||||||
EventBuffer->no_history = true;
|
EventBuffer->no_history = true;
|
||||||
EventBuffer->special = 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) {
|
Int ConvertUTF8ToUTF16UnixLine(String string, char16_t *buffer, Int buffer_cap) {
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ void GotoNextInList(Window *window, Int line_offset = 1) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSet set = Open(line, "goto_build");
|
BSet set = Open(line, "dont_error");
|
||||||
if (set.window == NULL) {
|
if (set.window == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -445,6 +445,32 @@ BSet Exec(String cmd, String working_dir, bool set_active = true) {
|
|||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BSet ExecBuild(String cmd) {
|
||||||
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
|
ActiveWindowID = main.window->id;
|
||||||
|
CheckpointBeforeGoto(main.window);
|
||||||
|
View *view = WindowOpenBufferView(main.window, BuildBuffer->name);
|
||||||
|
ResetBuffer(BuildBuffer);
|
||||||
|
Exec(view->id, true, cmd, WorkDir);
|
||||||
|
main.window->active_goto_list = view->id;
|
||||||
|
main.window->goto_list_pos = 0;
|
||||||
|
return main;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Command_Build() {
|
||||||
|
ExecBuild("build.bat");
|
||||||
|
} RegisterCommand(Command_Build, "f1");
|
||||||
|
|
||||||
|
void Command_GotoNextInList() {
|
||||||
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
|
GotoNextInList(main.window, 1);
|
||||||
|
} RegisterCommand(Command_GotoNextInList, "ctrl-e");
|
||||||
|
|
||||||
|
void Command_GotoPrevInList() {
|
||||||
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
|
GotoNextInList(main.window, -1);
|
||||||
|
} RegisterCommand(Command_GotoPrevInList, "alt-e");
|
||||||
|
|
||||||
enum OpenKind {
|
enum OpenKind {
|
||||||
OpenKind_Invalid,
|
OpenKind_Invalid,
|
||||||
OpenKind_Skip,
|
OpenKind_Skip,
|
||||||
@@ -460,6 +486,11 @@ struct ResolvedOpen {
|
|||||||
Int line, col;
|
Int line, col;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool IsOpenBoundary(char c) {
|
||||||
|
bool result = c == 0 || IsParen(c) || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ResolvedOpen ResolveOpen(Allocator scratch, String path, String meta) {
|
ResolvedOpen ResolveOpen(Allocator scratch, String path, String meta) {
|
||||||
ResolvedOpen result = {};
|
ResolvedOpen result = {};
|
||||||
|
|
||||||
@@ -500,24 +531,42 @@ ResolvedOpen ResolveOpen(Allocator scratch, String path, String meta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse ":line:column"
|
|
||||||
{
|
{
|
||||||
path = NormalizePath(scratch, path);
|
String p = NormalizePath(scratch, path);
|
||||||
String p = path;
|
String pstart = p;
|
||||||
Int a = ChopNumber(&p);
|
asd
|
||||||
if (a != -1 && Chop(&p, ":")) {
|
bool is_absolute = false;
|
||||||
path = p;
|
if (IsAlphabetic(ToLowerCase(At(p, 0))) && At(p, 1) == ':' && At(p, 2) == '/') {
|
||||||
Int b = ChopNumber(&p);
|
is_absolute = true;
|
||||||
if (b != -1 && Chop(&p, ":")) {
|
p = Skip(p, 3);
|
||||||
path = p;
|
} else if (At(p, 0) == '/') {
|
||||||
result.col = a;
|
is_absolute = true;
|
||||||
result.line = b;
|
p = Skip(p, 1);
|
||||||
} else {
|
}
|
||||||
result.line = a;
|
|
||||||
}
|
while (!IsOpenBoundary(At(p, 0))) {
|
||||||
|
p = Skip(p, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse ":line:column"
|
||||||
|
// {
|
||||||
|
// path = NormalizePath(scratch, path);
|
||||||
|
// String p = path;
|
||||||
|
// Int a = ChopNumber(&p);
|
||||||
|
// if (a != -1 && Chop(&p, ":")) {
|
||||||
|
// path = p;
|
||||||
|
// Int b = ChopNumber(&p);
|
||||||
|
// if (b != -1 && Chop(&p, ":")) {
|
||||||
|
// path = p;
|
||||||
|
// result.col = a;
|
||||||
|
// result.line = b;
|
||||||
|
// } else {
|
||||||
|
// result.line = a;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
Buffer *existing_buffer = GetBuffer(path, NULL);
|
Buffer *existing_buffer = GetBuffer(path, NULL);
|
||||||
if (existing_buffer != NULL) {
|
if (existing_buffer != NULL) {
|
||||||
result.path = path;
|
result.path = path;
|
||||||
@@ -540,6 +589,10 @@ ResolvedOpen ResolveOpen(Allocator scratch, String path, String meta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meta == "dont_error") {
|
||||||
|
result.kind = OpenKind_Skip;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ Array<Window *> Windows;
|
|||||||
Array<View *> Views;
|
Array<View *> Views;
|
||||||
Array<Buffer *> Buffers;
|
Array<Buffer *> Buffers;
|
||||||
|
|
||||||
// console
|
// First window
|
||||||
BufferID NullBufferID;
|
BufferID NullBufferID;
|
||||||
ViewID NullViewID;
|
ViewID NullViewID;
|
||||||
WindowID NullWindowID;
|
WindowID NullWindowID;
|
||||||
|
|
||||||
|
|
||||||
// hidden floating window
|
// hidden floating window
|
||||||
WindowID DebugWindowID;
|
WindowID DebugWindowID;
|
||||||
ViewID DebugViewID;
|
ViewID DebugViewID;
|
||||||
@@ -39,6 +40,7 @@ WindowID ResizerSelected = {-1};
|
|||||||
WindowID ResizerHover = {-1};
|
WindowID ResizerHover = {-1};
|
||||||
Caret DocumentAnchor;
|
Caret DocumentAnchor;
|
||||||
|
|
||||||
|
Buffer *BuildBuffer;
|
||||||
Buffer *GCInfoBuffer;
|
Buffer *GCInfoBuffer;
|
||||||
Buffer *EventBuffer;
|
Buffer *EventBuffer;
|
||||||
Buffer *TraceBuffer;
|
Buffer *TraceBuffer;
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ void OnCommand(Event event) {
|
|||||||
Assert(DocumentSelected.id == -1);
|
Assert(DocumentSelected.id == -1);
|
||||||
|
|
||||||
BSet active = GetBSet(ActiveWindowID); // using next to make sure mouse works on first click after switching the window
|
BSet active = GetBSet(ActiveWindowID); // using next to make sure mouse works on first click after switching the window
|
||||||
bool mouse_in_document = AreOverlapping(mouse, active.window->document_rect);
|
bool mouse_in_document = AreOverlapping(mouse, active.window->document_rect);
|
||||||
bool mouse_in_line_numbers = AreOverlapping(mouse, active.window->line_numbers_rect);
|
bool mouse_in_line_numbers = AreOverlapping(mouse, active.window->line_numbers_rect);
|
||||||
if (mouse_in_document || mouse_in_line_numbers) {
|
if (mouse_in_document || mouse_in_line_numbers) {
|
||||||
DocumentSelected = active.window->id;
|
DocumentSelected = active.window->id;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
void CommandWindowInit() {
|
void CommandWindowInit() {
|
||||||
Window *window = CreateWind();
|
Window *window = CreateWind();
|
||||||
CommandWindowID = window->id;
|
CommandWindowID = window->id;
|
||||||
Buffer *buffer = CreateBuffer(SysAllocator, "command_bar");
|
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(WorkDir, "command_bar"));
|
||||||
buffer->special = true;
|
buffer->special = true;
|
||||||
View *view = CreateView(buffer->id);
|
View *view = CreateView(buffer->id);
|
||||||
view->special = true;
|
view->special = true;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
void SearchWindowInit() {
|
void SearchWindowInit() {
|
||||||
Window *window = CreateWind();
|
Window *window = CreateWind();
|
||||||
SearchWindowID = window->id;
|
SearchWindowID = window->id;
|
||||||
Buffer *buffer = CreateBuffer(SysAllocator, "search_bar");
|
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(WorkDir, "search"));
|
||||||
buffer->special = true;
|
buffer->special = true;
|
||||||
SearchBufferID = buffer->id;
|
SearchBufferID = buffer->id;
|
||||||
View *view = CreateView(buffer->id);
|
View *view = CreateView(buffer->id);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
void StatusWindowInit() {
|
void StatusWindowInit() {
|
||||||
Window *window = CreateWind();
|
Window *window = CreateWind();
|
||||||
StatusBarWindowID = window->id;
|
StatusBarWindowID = window->id;
|
||||||
Buffer *buffer = CreateBuffer(SysAllocator, "status_bar");
|
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(WorkDir, "status_bar"));
|
||||||
buffer->special = true;
|
buffer->special = true;
|
||||||
View *view = CreateView(buffer->id);
|
View *view = CreateView(buffer->id);
|
||||||
view->special = true;
|
view->special = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user