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
end
function OnUpdate()
end
)==";

View File

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

View File

@@ -300,7 +300,7 @@ Int LuaBufferChangeID = 0;
void ReloadStyle();
extern String BaseLuaConfig;
void UpdateLuaConfig() {
void UpdateLua() {
if (LuaBufferID.id == -1) return;
Buffer *lua_buffer = GetBuffer(LuaBufferID);
@@ -329,6 +329,14 @@ void UpdateLuaConfig() {
}
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() {
@@ -360,7 +368,7 @@ void InitLuaConfig() {
LuaBufferChangeID = 1;
LuaBufferID = lua_buffer->id;
UpdateLuaConfig();
UpdateLua();
}
//

View File

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

View File

@@ -1,13 +1,11 @@
- 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 backwards
- some split selection commands
- 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
- Fix fuzzy search look