2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-20 20:43:23 +00:00

fix: return after error in abbr.expand

This commit is contained in:
sammyette 2025-04-03 00:42:25 -04:00
parent 2f8ab6f5d6
commit 43d8dbc460
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -12,9 +12,7 @@ hilbish.abbr = {
all = {} all = {}
} }
print 'abbr loaded' 2--- Adds an abbreviation. The `abbr` is the abbreviation itself,
--- Adds an abbreviation. The `abbr` is the abbreviation itself,
--- while `expanded` is what the abbreviation should expand to. --- while `expanded` is what the abbreviation should expand to.
--- It can be either a function or a string. If it is a function, it will expand to what --- It can be either a function or a string. If it is a function, it will expand to what
--- the function returns. --- the function returns.
@ -54,19 +52,10 @@ bait.catch('hilbish.rawInput', function(c)
local expandRet = thisAbbr.expand() local expandRet = thisAbbr.expand()
if type(expandRet) ~= 'string' then if type(expandRet) ~= 'string' then
print(string.format('abbr %s has an expand function that did not return a string. instead it returned: %s', thisAbbr.abbr, expandRet)) print(string.format('abbr %s has an expand function that did not return a string. instead it returned: %s', thisAbbr.abbr, expandRet))
return
end end
hilbish.editor.insert(expandRet) hilbish.editor.insert(expandRet)
end end
end end
end end
end) end)
hilbish.abbr.add('tt', 'echo titties')
hilbish.abbr.add('idk', 'i dont know', {
anywhere = true
})
hilbish.abbr.add('!!', function()
return hilbish.history.get(hilbish.history.size() - 1)
end)