Lua OnUpdate

This commit is contained in:
Krzosa Karol
2024-08-09 16:19:00 +02:00
parent d98086d869
commit 65ef0b1b0f
5 changed files with 16 additions and 6 deletions

View File

@@ -324,6 +324,8 @@ function ApplyRules(s)
return nil return nil
end end
function OnUpdate()
end
)=="; )==";

View File

@@ -213,6 +213,8 @@ function ApplyRules(s)
return nil return nil
end end
function OnUpdate()
end
)=="; )==";

View File

@@ -300,7 +300,7 @@ Int LuaBufferChangeID = 0;
void ReloadStyle(); void ReloadStyle();
extern String BaseLuaConfig; extern String BaseLuaConfig;
void UpdateLuaConfig() { void UpdateLua() {
if (LuaBufferID.id == -1) return; if (LuaBufferID.id == -1) return;
Buffer *lua_buffer = GetBuffer(LuaBufferID); Buffer *lua_buffer = GetBuffer(LuaBufferID);
@@ -329,6 +329,14 @@ void UpdateLuaConfig() {
} }
LuaBufferChangeID = lua_buffer->change_id; LuaBufferChangeID = lua_buffer->change_id;
} }
lua_getglobal(LuaState, "OnUpdate");
if (lua_pcall(LuaState, 0, 0, 0) != 0) {
const char *error_message = lua_tostring(LuaState, -1);
ReportWarningf("Failed the call to OnUpdate! %s", error_message);
lua_pop(LuaState, 1);
return;
}
} }
void InitLuaConfig() { void InitLuaConfig() {
@@ -360,7 +368,7 @@ void InitLuaConfig() {
LuaBufferChangeID = 1; LuaBufferChangeID = 1;
LuaBufferID = lua_buffer->id; LuaBufferID = lua_buffer->id;
UpdateLuaConfig(); UpdateLua();
} }
// //

View File

@@ -183,7 +183,7 @@ void Update(Event event) {
HandleEvent(event); HandleEvent(event);
UpdateProcesses(); UpdateProcesses();
UpdateLuaConfig(); UpdateLua();
UpdateDebugBuffer(); UpdateDebugBuffer();
For(IterateInReverse(&order)) { For(IterateInReverse(&order)) {

View File

@@ -1,13 +1,11 @@
- Remove pointers and use ViewIDs (enable array debug while doing this) - Remove pointers and use ViewIDs (enable array debug while doing this)
- try using git grep for search for now, combine with fuzzy search buffer
- lua maybe try heuristic matching paths from left?
- search as a command to execute which is going to be in the title bar - search as a command to execute which is going to be in the title bar
- search backwards - search backwards
- some split selection commands - some split selection commands
- assign commands or lua functions to F1-F8 keys - assign commands or lua functions to F1-F8 keys
- Cycle up and down through a list of filenames and jump to every filename listed - Cycle up and down through a list of filenames and jump to every filename listed and remember the last buffer which we jumped from which contains the list
- A lister which is going to show project without the full path and sorted by recency - A lister which is going to show project without the full path and sorted by recency
- Fix fuzzy search look - Fix fuzzy search look