Testing setup using project files
This commit is contained in:
@@ -331,11 +331,6 @@ function AddCo(f)
|
|||||||
return Coroutines[i]
|
return Coroutines[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
function AddTest(f)
|
|
||||||
local ff = AddCo(f)
|
|
||||||
coroutine.resume(ff)
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnUpdate()
|
function OnUpdate()
|
||||||
local new_co_list = {}
|
local new_co_list = {}
|
||||||
for key, co in pairs(Coroutines) do
|
for key, co in pairs(Coroutines) do
|
||||||
@@ -348,7 +343,6 @@ function OnUpdate()
|
|||||||
Coroutines = new_co_list
|
Coroutines = new_co_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
)==";
|
)==";
|
||||||
|
|
||||||
void GenerateConfig() {
|
void GenerateConfig() {
|
||||||
@@ -421,6 +415,7 @@ void GenerateConfig() {
|
|||||||
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
||||||
|
|
||||||
Array<Var> style = {};
|
Array<Var> style = {};
|
||||||
|
style.add({"WaitForEvents", "1"});
|
||||||
style.add({"DrawLineNumbers", "1"});
|
style.add({"DrawLineNumbers", "1"});
|
||||||
style.add({"DrawScrollbar", "1"});
|
style.add({"DrawScrollbar", "1"});
|
||||||
style.add({"IndentSize", "4"});
|
style.add({"IndentSize", "4"});
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ Color.TitleBarText = GruvboxDark2
|
|||||||
Color.TitleBarBackground = GruvboxLight1
|
Color.TitleBarBackground = GruvboxLight1
|
||||||
Color.TitleBarSelection = GruvboxLight3
|
Color.TitleBarSelection = GruvboxLight3
|
||||||
Style = {}
|
Style = {}
|
||||||
|
Style.WaitForEvents = 1
|
||||||
Style.DrawLineNumbers = 1
|
Style.DrawLineNumbers = 1
|
||||||
Style.DrawScrollbar = 1
|
Style.DrawScrollbar = 1
|
||||||
Style.IndentSize = 4
|
Style.IndentSize = 4
|
||||||
@@ -220,11 +221,6 @@ function AddCo(f)
|
|||||||
return Coroutines[i]
|
return Coroutines[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
function AddTest(f)
|
|
||||||
local ff = AddCo(f)
|
|
||||||
coroutine.resume(ff)
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnUpdate()
|
function OnUpdate()
|
||||||
local new_co_list = {}
|
local new_co_list = {}
|
||||||
for key, co in pairs(Coroutines) do
|
for key, co in pairs(Coroutines) do
|
||||||
@@ -238,7 +234,6 @@ function OnUpdate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
)==";
|
)==";
|
||||||
void ReloadStyle() {
|
void ReloadStyle() {
|
||||||
ColorText = GetColor("Text", ColorText);
|
ColorText = GetColor("Text", ColorText);
|
||||||
@@ -260,6 +255,7 @@ void ReloadStyle() {
|
|||||||
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
||||||
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
||||||
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
||||||
|
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
|
||||||
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
||||||
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
||||||
StyleIndentSize = GetStyleInt("IndentSize", StyleIndentSize);
|
StyleIndentSize = GetStyleInt("IndentSize", StyleIndentSize);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
|
|||||||
Color ColorTitleBarText = GruvboxDark2;
|
Color ColorTitleBarText = GruvboxDark2;
|
||||||
Color ColorTitleBarBackground = GruvboxLight1;
|
Color ColorTitleBarBackground = GruvboxLight1;
|
||||||
Color ColorTitleBarSelection = GruvboxLight3;
|
Color ColorTitleBarSelection = GruvboxLight3;
|
||||||
|
Int StyleWaitForEvents = 1;
|
||||||
Int StyleDrawLineNumbers = 1;
|
Int StyleDrawLineNumbers = 1;
|
||||||
Int StyleDrawScrollbar = 1;
|
Int StyleDrawScrollbar = 1;
|
||||||
Int StyleIndentSize = 4;
|
Int StyleIndentSize = 4;
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ Vec2 GetVec2(lua_State *L, const char *name) {
|
|||||||
Vec2 result = {};
|
Vec2 result = {};
|
||||||
lua_getfield(L, -1, name);
|
lua_getfield(L, -1, name);
|
||||||
defer { lua_pop(L, 1); };
|
defer { lua_pop(L, 1); };
|
||||||
|
if (!lua_istable(L, -1)) return result;
|
||||||
|
|
||||||
{
|
{
|
||||||
lua_getfield(L, -1, "1");
|
lua_getfield(L, -1, "1");
|
||||||
|
|||||||
@@ -289,8 +289,9 @@ int main(int argc, char **argv)
|
|||||||
InitScratchBuffer();
|
InitScratchBuffer();
|
||||||
InitRender();
|
InitRender();
|
||||||
ReloadFont();
|
ReloadFont();
|
||||||
|
InitWindows();
|
||||||
|
InitOS(ReportWarningf);
|
||||||
|
|
||||||
Array<String> files_to_load = {};
|
|
||||||
for (int i = 1; i < argc; i += 1) {
|
for (int i = 1; i < argc; i += 1) {
|
||||||
String it = argv[i];
|
String it = argv[i];
|
||||||
if (!FileExists(it)) continue;
|
if (!FileExists(it)) continue;
|
||||||
@@ -301,18 +302,12 @@ int main(int argc, char **argv)
|
|||||||
LuaProjectBuffer->user_change_id = -1;
|
LuaProjectBuffer->user_change_id = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Add(&files_to_load, it);
|
Window *window = GetWindow({0});
|
||||||
|
WindowOpenBufferView(window, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InitLuaConfig();
|
InitLuaConfig();
|
||||||
InitWindows();
|
|
||||||
InitOS(ReportWarningf);
|
|
||||||
|
|
||||||
For(files_to_load) {
|
|
||||||
Window *window = GetWindow({0});
|
|
||||||
WindowOpenBufferView(window, it);
|
|
||||||
}
|
|
||||||
|
|
||||||
Serializer ser = {EventBuffer};
|
Serializer ser = {EventBuffer};
|
||||||
while (AppIsRunning) {
|
while (AppIsRunning) {
|
||||||
@@ -326,7 +321,7 @@ int main(int argc, char **argv)
|
|||||||
Update(it);
|
Update(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
WaitForEvents = true;
|
WaitForEvents = StyleWaitForEvents;
|
||||||
if (IsDocumentSelectionValid() || IsScrollbarSelectionValid()) {
|
if (IsDocumentSelectionValid() || IsScrollbarSelectionValid()) {
|
||||||
WaitForEvents = false;
|
WaitForEvents = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,12 +132,9 @@ void InitWindows() {
|
|||||||
Window *window = CreateWindow();
|
Window *window = CreateWindow();
|
||||||
WindowID window_id = window->id;
|
WindowID window_id = window->id;
|
||||||
window->is_column = true;
|
window->is_column = true;
|
||||||
// window->draw_line_numbers = false;
|
Buffer *buffer = CreateBuffer(sys_allocator, BuffCWD("+test_buffer"));
|
||||||
Buffer *buffer = CreateBuffer(sys_allocator, BuffCWD("+test_buffer"));
|
View *view = CreateView(buffer->id);
|
||||||
View *view = CreateView(buffer->id);
|
|
||||||
// LoadTextA(buffer);
|
|
||||||
LoadUnicode(buffer);
|
LoadUnicode(buffer);
|
||||||
// LoadBigTextAndBigLine(buffer, 10000000);
|
|
||||||
window->active_view = view->id;
|
window->active_view = view->id;
|
||||||
CreateTitlebar(window_id);
|
CreateTitlebar(window_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user