diff --git a/build_file.cpp b/build_file.cpp index 2f68782..b60603c 100644 --- a/build_file.cpp +++ b/build_file.cpp @@ -253,16 +253,18 @@ void GenerateConfig() { colors.add({"TitleBarSelection", "GruvboxLight3"}); Array style = {}; + style.add({"ConsoleSizeSmall", "10"}); + style.add({"ConsoleSizeBig", "30"}); style.add({"WaitForEvents", "1"}); style.add({"DrawLineNumbers", "1"}); style.add({"DrawScrollbar", "1"}); style.add({"IndentSize", "4"}); style.add({"TrimWhitespaceOnSave", "1"}); style.add({"ClangFormatOnSave", "0"}); - style.add({"FontSize", "12"}); + style.add({"FontSize", "15"}); style.add({"FontFilter", "0"}); // nearest = 0, linear = 1 - seems like nearest always better? style.add({"Font", "C:/Windows/Fonts/consola.ttf"}); - style.add({"VCVarsall", "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"}); + style.add({"VCVarsall", "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"}); { MA_Scratch scratch; diff --git a/data/init.lua b/data/init.lua index 1ec6e3b..e231edb 100644 --- a/data/init.lua +++ b/data/init.lua @@ -11,6 +11,9 @@ SDLK_Q = 113 SDLK_BACKSLASH = 0x5c SDLK_RETURN = 13 +SDLK_EQUALS = 0x0000003d +SDLK_MINUS = 0x0000002d + SDLK_F1 = 0x4000003a SDLK_F2 = 0x4000003b SDLK_F3 = 0x4000003c diff --git a/src/text_editor/commands_bindings.cpp b/src/text_editor/commands_bindings.cpp index 86fe894..1565391 100644 --- a/src/text_editor/commands_bindings.cpp +++ b/src/text_editor/commands_bindings.cpp @@ -497,6 +497,13 @@ void OnCommand(Event event) { Command_IndentSelectedLines(active.view); } + if (CtrlPress(SDLK_LEFTBRACKET)) { + Command_IndentSelectedLines(active.view, SHIFT_PRESSED); + } + if (CtrlPress(SDLK_RIGHTBRACKET)) { + Command_IndentSelectedLines(active.view); + } + if (CtrlShiftPress(SDLK_K)) { Command_KillSelectedLines(active.view); } diff --git a/src/text_editor/generated.cpp b/src/text_editor/generated.cpp index 1eea2bc..2805e41 100644 --- a/src/text_editor/generated.cpp +++ b/src/text_editor/generated.cpp @@ -57,16 +57,18 @@ Color.TitleBarText = GruvboxDark2 Color.TitleBarBackground = GruvboxLight1 Color.TitleBarSelection = GruvboxLight3 Style = {} +Style.ConsoleSizeSmall = 10 +Style.ConsoleSizeBig = 30 Style.WaitForEvents = 1 Style.DrawLineNumbers = 1 Style.DrawScrollbar = 1 Style.IndentSize = 4 Style.TrimWhitespaceOnSave = 1 Style.ClangFormatOnSave = 0 -Style.FontSize = 12 +Style.FontSize = 15 Style.FontFilter = 0 Style.Font = "C:/Windows/Fonts/consola.ttf" -Style.VCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat" +Style.VCVarsall = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat" INTERNET_BROWSER = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe' SDLK_CTRL = 1073742048 @@ -80,6 +82,9 @@ SDLK_Q = 113 SDLK_BACKSLASH = 0x5c SDLK_RETURN = 13 +SDLK_EQUALS = 0x0000003d +SDLK_MINUS = 0x0000002d + SDLK_F1 = 0x4000003a SDLK_F2 = 0x4000003b SDLK_F3 = 0x4000003c @@ -343,6 +348,8 @@ void ReloadStyle() { ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText); ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground); ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection); + StyleConsoleSizeSmall = GetStyleInt("ConsoleSizeSmall", StyleConsoleSizeSmall); + StyleConsoleSizeBig = GetStyleInt("ConsoleSizeBig", StyleConsoleSizeBig); StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents); StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers); StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar); diff --git a/src/text_editor/generated_variables.cpp b/src/text_editor/generated_variables.cpp index 3c32f07..cb5ef6b 100644 --- a/src/text_editor/generated_variables.cpp +++ b/src/text_editor/generated_variables.cpp @@ -54,13 +54,15 @@ Color ColorScrollbarScrollerSelected = GruvboxLight0Hard; Color ColorTitleBarText = GruvboxDark2; Color ColorTitleBarBackground = GruvboxLight1; Color ColorTitleBarSelection = GruvboxLight3; +Int StyleConsoleSizeSmall = 10; +Int StyleConsoleSizeBig = 30; Int StyleWaitForEvents = 1; Int StyleDrawLineNumbers = 1; Int StyleDrawScrollbar = 1; Int StyleIndentSize = 4; Int StyleTrimWhitespaceOnSave = 1; Int StyleClangFormatOnSave = 0; -Int StyleFontSize = 12; +Int StyleFontSize = 15; Int StyleFontFilter = 0; String StyleFont = "C:/Windows/Fonts/consola.ttf"; -String StyleVCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"; \ No newline at end of file +String StyleVCVarsall = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"; \ No newline at end of file diff --git a/src/text_editor/lua_api.cpp b/src/text_editor/lua_api.cpp index 781889c..472dc33 100644 --- a/src/text_editor/lua_api.cpp +++ b/src/text_editor/lua_api.cpp @@ -1,5 +1,7 @@ lua_State *LuaState = NULL; String16 LuaCommandResult = {}; +extern luaL_Reg LuaFunctions[]; + String FieldString(lua_State *L, String name) { String result = {}; @@ -254,6 +256,20 @@ int Lua_SetProjectFile(lua_State *L) { return 0; } +int Lua_ListCommands(lua_State *L) { + BSet main = GetActiveMainSet(); + Command_BeginConsoleJump(&main); + for (int i = 0; LuaFunctions[i].name != NULL; i += 1) { + Command_Appendf(main.view, "%20s() ", LuaFunctions[i].name); + if (((i + 1) % 6) == 0) { + Command_Appendf(main.view, "\n"); + } + } + Command_EndConsoleJump(main); + ActiveWindow = main.window->id; + return 0; +} + int Lua_Reopen(lua_State *L) { ReopenBuffer(GetActiveMainSet()); return 0; @@ -370,8 +386,6 @@ static void HookLuaForceExit(lua_State *L, lua_Debug *debug) { luaL_error(L, "lua execution got interrupted"); } -extern luaL_Reg LuaFunctions[]; - Int GetStyleInt(String name, Int default_int) { Int result = default_int; lua_getglobal(LuaState, "Style"); diff --git a/src/text_editor/lua_api_generated.cpp b/src/text_editor/lua_api_generated.cpp index 67aa724..49e4f9f 100644 --- a/src/text_editor/lua_api_generated.cpp +++ b/src/text_editor/lua_api_generated.cpp @@ -9,6 +9,7 @@ luaL_Reg LuaFunctions[] = { {"New", Lua_New}, {"Open", Lua_Open}, {"SetProjectFile", Lua_SetProjectFile}, + {"ListCommands", Lua_ListCommands}, {"Reopen", Lua_Reopen}, {"ToggleFullscreen", Lua_ToggleFullscreen}, {"ListBuffers", Lua_ListBuffers}, diff --git a/src/text_editor/management.cpp b/src/text_editor/management.cpp index 2c3cac0..10b9b45 100644 --- a/src/text_editor/management.cpp +++ b/src/text_editor/management.cpp @@ -9,7 +9,6 @@ Array Windows; BufferID NullBufferID; // +buffer ViewID NullViewID; WindowID NullWindowID; -Int NullWindowSize = 5; WindowID DebugWindowID; // +debug BufferID DebugBufferID; diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 3274f2b..943bb58 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -337,7 +337,7 @@ int main(int argc, char **argv) String it = argv[i]; if (!FileExists(it)) continue; - if (EndsWith(it, ".lua_project")) { + if (EndsWith(it, ".project.lua")) { if (!LuaProjectBuffer) { LuaProjectBuffer = BufferOpenFile(it); LuaProjectBuffer->user_change_id = -1; diff --git a/src/text_editor/window.cpp b/src/text_editor/window.cpp index 49e681a..f21cb58 100644 --- a/src/text_editor/window.cpp +++ b/src/text_editor/window.cpp @@ -275,13 +275,13 @@ void LayoutWindows(int16_t wx, int16_t wy) { { Window *window = GetWindow(NullWindowID); + + Int console_panel_size = StyleConsoleSizeSmall; if (ActiveWindow == window->id) { - NullWindowSize = 20; - } else { - NullWindowSize = 5; + console_panel_size = StyleConsoleSizeBig; } - Rect2I rect = CutBottom(&screen_rect, FontLineSpacing*NullWindowSize); + Rect2I rect = CutBottom(&screen_rect, FontLineSpacing*console_panel_size); Window *title_bar_window = GetWindow(window->title_bar_window); title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window)); diff --git a/te.lua_project b/te.project.lua similarity index 89% rename from te.lua_project rename to te.project.lua index ca6b167..e900ffe 100644 --- a/te.lua_project +++ b/te.project.lua @@ -1,7 +1,6 @@ function OnCommandTE(e) if e.key == SDLK_B and e.ctrl == 1 then - local cmd = "cd "..GetProjectPath().." && build.bat" - C(cmd) + Cmd { working_dir = GetProjectPath(), destination = "console", cmd = "build.bat" } end end @@ -44,4 +43,4 @@ end table.insert(OnCommandCallbacks, OnCommandTE) table.insert(Rules, 1, MatchGrep) -table.insert(Rules, MatchProject) \ No newline at end of file +table.insert(Rules, MatchProject)