Add lua interrupt on F9

This commit is contained in:
Krzosa Karol
2024-08-09 09:39:40 +02:00
parent ad847a3eaa
commit 68ff6dc2b5
3 changed files with 13 additions and 3 deletions

View File

@@ -184,6 +184,14 @@ int LuaGetCurrentBufferDir(lua_State *L) {
return 1;
}
static void HookLuaForceExit(lua_State *L, lua_Debug *debug) {
SDL_PumpEvents();
int numkeys = 0;
const uint8_t *keys = SDL_GetKeyboardState(&numkeys);
if (keys[SDL_SCANCODE_F9] > 0)
luaL_error(L, "lua execution got interrupted");
}
luaL_Reg LuaFunctions[] = {
{ "Open", LuaOpen},
{ "ListBuffers", LuaListBuffers},
@@ -202,6 +210,7 @@ luaL_Reg LuaFunctions[] = {
void InitLua() {
LuaState = luaL_newstate();
luaL_openlibs(LuaState);
lua_sethook(LuaState, HookLuaForceExit, LUA_MASKCOUNT, 100000000);
for (int i = 0; LuaFunctions[i].name; i += 1) {
lua_pushcfunction(LuaState, LuaFunctions[i].func);

View File

@@ -5,13 +5,15 @@ right_mouse :: ctrl exec word,alt go back
ctrl mleft - add cursor
ctrl shift mleft - add cursor + set selection
ctrl shift mleft - add cursor and set selection
alt mleft -
alt ctrl mleft -
alt shift mleft -
mright - destroy pointed at selection and copy | copy line
alt mright - go back
mright - destroy pointed at selection and copy
ctrl mright - load word
shift mright -
alt shift mright -
alt ctrl mright -
ctrl shift mright - exec word
mmiddle -

View File

@@ -1,7 +1,6 @@
- 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?
- prevent lua from infinite looping
- Append to console and change console directory
- win32: change all stack buffers to arena