Testing setup using project files

This commit is contained in:
Krzosa Karol
2024-08-14 16:03:29 +02:00
parent a84a7073dc
commit 212392386c
6 changed files with 12 additions and 27 deletions

View File

@@ -331,11 +331,6 @@ function AddCo(f)
return Coroutines[i]
end
function AddTest(f)
local ff = AddCo(f)
coroutine.resume(ff)
end
function OnUpdate()
local new_co_list = {}
for key, co in pairs(Coroutines) do
@@ -348,7 +343,6 @@ function OnUpdate()
Coroutines = new_co_list
end
)==";
void GenerateConfig() {
@@ -421,6 +415,7 @@ void GenerateConfig() {
colors.add({"TitleBarSelection", "GruvboxLight3"});
Array<Var> style = {};
style.add({"WaitForEvents", "1"});
style.add({"DrawLineNumbers", "1"});
style.add({"DrawScrollbar", "1"});
style.add({"IndentSize", "4"});

View File

@@ -57,6 +57,7 @@ Color.TitleBarText = GruvboxDark2
Color.TitleBarBackground = GruvboxLight1
Color.TitleBarSelection = GruvboxLight3
Style = {}
Style.WaitForEvents = 1
Style.DrawLineNumbers = 1
Style.DrawScrollbar = 1
Style.IndentSize = 4
@@ -220,11 +221,6 @@ function AddCo(f)
return Coroutines[i]
end
function AddTest(f)
local ff = AddCo(f)
coroutine.resume(ff)
end
function OnUpdate()
local new_co_list = {}
for key, co in pairs(Coroutines) do
@@ -238,7 +234,6 @@ function OnUpdate()
end
)==";
void ReloadStyle() {
ColorText = GetColor("Text", ColorText);
@@ -260,6 +255,7 @@ void ReloadStyle() {
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
StyleIndentSize = GetStyleInt("IndentSize", StyleIndentSize);

View File

@@ -54,6 +54,7 @@ Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
Color ColorTitleBarText = GruvboxDark2;
Color ColorTitleBarBackground = GruvboxLight1;
Color ColorTitleBarSelection = GruvboxLight3;
Int StyleWaitForEvents = 1;
Int StyleDrawLineNumbers = 1;
Int StyleDrawScrollbar = 1;
Int StyleIndentSize = 4;

View File

@@ -305,6 +305,7 @@ Vec2 GetVec2(lua_State *L, const char *name) {
Vec2 result = {};
lua_getfield(L, -1, name);
defer { lua_pop(L, 1); };
if (!lua_istable(L, -1)) return result;
{
lua_getfield(L, -1, "1");

View File

@@ -289,8 +289,9 @@ int main(int argc, char **argv)
InitScratchBuffer();
InitRender();
ReloadFont();
InitWindows();
InitOS(ReportWarningf);
Array<String> files_to_load = {};
for (int i = 1; i < argc; i += 1) {
String it = argv[i];
if (!FileExists(it)) continue;
@@ -301,18 +302,12 @@ int main(int argc, char **argv)
LuaProjectBuffer->user_change_id = -1;
}
} else {
Add(&files_to_load, it);
Window *window = GetWindow({0});
WindowOpenBufferView(window, it);
}
}
InitLuaConfig();
InitWindows();
InitOS(ReportWarningf);
For(files_to_load) {
Window *window = GetWindow({0});
WindowOpenBufferView(window, it);
}
Serializer ser = {EventBuffer};
while (AppIsRunning) {
@@ -326,7 +321,7 @@ int main(int argc, char **argv)
Update(it);
}
WaitForEvents = true;
WaitForEvents = StyleWaitForEvents;
if (IsDocumentSelectionValid() || IsScrollbarSelectionValid()) {
WaitForEvents = false;
}

View File

@@ -132,12 +132,9 @@ void InitWindows() {
Window *window = CreateWindow();
WindowID window_id = window->id;
window->is_column = true;
// window->draw_line_numbers = false;
Buffer *buffer = CreateBuffer(sys_allocator, BuffCWD("+test_buffer"));
View *view = CreateView(buffer->id);
// LoadTextA(buffer);
Buffer *buffer = CreateBuffer(sys_allocator, BuffCWD("+test_buffer"));
View *view = CreateView(buffer->id);
LoadUnicode(buffer);
// LoadBigTextAndBigLine(buffer, 10000000);
window->active_view = view->id;
CreateTitlebar(window_id);
}