diff --git a/src/text_editor/lua_api.cpp b/src/text_editor/lua_api.cpp index be7a989..0acc18f 100644 --- a/src/text_editor/lua_api.cpp +++ b/src/text_editor/lua_api.cpp @@ -1,4 +1,4 @@ -int Lua_Print(lua_State *L) { +int Lua_print(lua_State *L) { Scratch scratch; int nargs = lua_gettop(L); View *null_view = GetView(NullViewID); @@ -11,6 +11,19 @@ int Lua_Print(lua_State *L) { return 0; } +int Lua_Print(lua_State *L) { + Scratch scratch; + int nargs = lua_gettop(L); + View *view = GetView(DebugViewID); + for (int i = 1; i <= nargs; i += 1) { + String string = lua_tostring(L, i); + Command_Appendf(view, "%.*s ", FmtString(string)); + } + Command_Appendf(view, "\n"); + lua_pop(L, nargs); + return 0; +} + int Lua_Kill(lua_State *L) { BSet main = GetActiveMainSet(); KillProcess(main.view); diff --git a/src/text_editor/lua_api_generated.cpp b/src/text_editor/lua_api_generated.cpp index c5fe027..de5f768 100644 --- a/src/text_editor/lua_api_generated.cpp +++ b/src/text_editor/lua_api_generated.cpp @@ -1,4 +1,5 @@ luaL_Reg LuaFunctions[] = { + {"print", Lua_print}, {"Print", Lua_Print}, {"Kill", Lua_Kill}, {"GetLoadWord", Lua_GetLoadWord}, diff --git a/src/text_editor/management.cpp b/src/text_editor/management.cpp index b8e81ea..4db04f2 100644 --- a/src/text_editor/management.cpp +++ b/src/text_editor/management.cpp @@ -21,6 +21,7 @@ WindowID NullWindowID; // hidden floating window WindowID DebugWindowID; +ViewID DebugViewID; BufferID DebugBufferID; WindowSplit WindowSplits; diff --git a/src/text_editor/todo.txt b/src/text_editor/todo.txt index 5a6c40b..cc3a66e 100644 --- a/src/text_editor/todo.txt +++ b/src/text_editor/todo.txt @@ -1,4 +1,5 @@ FEATURE SaveAll dirty files which are saved on disk already but dirty +DESIGN try to make console less special, make stuff reusable etc. DESIGN Config file versions, when loading should be checked, at the top of the file, what to do when old version? ISSUE Ctrl+Alt+Down (DuplicateLine) doesn't work on ubuntu DESIGN Moving vertically between splits, which keys??? @@ -53,7 +54,6 @@ backlog - redo tree - gap buffer - optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor -- fix sdl mouse cursor code, visual artifacts, fast cursor changing stuff !!As little lua code as possible, but lua code should be powerful just in case of quick edits \ No newline at end of file diff --git a/src/text_editor/window.cpp b/src/text_editor/window.cpp index e4da965..bcfbbfa 100644 --- a/src/text_editor/window.cpp +++ b/src/text_editor/window.cpp @@ -197,6 +197,7 @@ void InitWindows() { buffer->no_history = true; View *view = CreateView(buffer->id); + DebugViewID = view->id; window->active_view = view->id; Window *titlebar = CreateTitlebar(window->id);