ALOT OF CHANGES

This commit is contained in:
krzosa
2025-04-29 16:22:26 +02:00
parent ed9ec06eee
commit 92139cf799
38 changed files with 2230 additions and 1967 deletions

View File

@@ -187,6 +187,7 @@ SDLK_RIGHT = 1073741903
SDLK_LEFT = 1073741904
SDLK_Q = 113
SDLK_BACKSLASH = 0x5c
SDLK_RETURN = 13
SDLK_F1 = 0x4000003a
SDLK_F2 = 0x4000003b
@@ -394,6 +395,40 @@ function ApplyRules(s)
return nil
end
function IsWhitespace(w)
local result = w == string.byte('\n') or
w == string.byte(' ') or
w == string.byte('\t') or
w == string.byte('\v') or
w == string.byte('\r')
return result
end
function IsSymbol(w)
local result = (w >= string.byte('!') and w <= string.byte('/')) or
(w >= string.byte(':') and w <= string.byte('@')) or
(w >= string.byte('[') and w <= string.byte('`')) or
(w >= string.byte('{') and w <= string.byte('~'))
return result
end
function IsLoadWord(w)
local result = w == string.byte('(') or
w == string.byte(')') or
w == string.byte('/') or
w == string.byte('\\') or
w == string.byte(':') or
w == string.byte('+') or
w == string.byte('_') or
w == string.byte('.') or
w == string.byte('-') or
w == string.byte(',')
if not result then
result = not (IsSymbol(w) or IsWhitespace(w))
end
return result
end
Coroutines = {}
function AddCo(f)
local i = #Coroutines + 1
@@ -414,18 +449,27 @@ function OnUpdate(e)
Coroutines = new_co_list
end
OnCommandCallbacks = {}
table.insert(OnCommandCallbacks, function (e)
if e.key == SDLK_F and e.ctrl == 1 and e.shift == 1 then
C("git grep -n "..GetLoadWord().." :/") end
if e.key == SDLK_L and e.ctrl == 1 then
Eval(GetLoadWord()) end
if e.key == SDLK_B and e.ctrl == 1 then
C(GetLoadWord()) end
end)
-- REMEBER: AS LITTLE ACTUAL CODE AS POSSIBLE IN LUA
-- ONLY CONFIGURABLES
function OnCommand(e)
if e.key == SDLK_F and e.ctrl == 1 and e.shift == 1 then
C("git grep -n "..GetLoadWord()) end
if e.key == SDLK_E and e.ctrl == 1 then
Eval(GetLoadWord()) end
for i = #OnCommandCallbacks,1,-1 do
on_command = OnCommandCallbacks[i]
on_command(e)
end
end
function OnInit()
end
)==";
void GenerateConfig() {