aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/events.lua9
-rw-r--r--core/keys.lua5
2 files changed, 7 insertions, 7 deletions
diff --git a/core/events.lua b/core/events.lua
index 19b556b1..b723e9f0 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -162,8 +162,9 @@ local error_emitted = false
function emit(event, ...)
local h = handlers[event]
if not h then return end
- for _, f in ipairs(h) do
- local ok, result = pcall(f, unpack{...})
+ local pcall, unpack, type = _G.pcall, _G.unpack, _G.type
+ for i = 1, #h do
+ local ok, result = pcall(h[i], unpack{...})
if not ok then
if not error_emitted then
error_emitted = true
@@ -199,7 +200,7 @@ local scnnotifications = {
function notification(n)
local f = scnnotifications[n.code]
if not f then return end
- local args = { unpack(f, 2) }
- for i, v in ipairs(args) do args[i] = n[v] end
+ local args = {}
+ for i = 2, #f do args[i - 1] = n[f[i]] end
return emit(f[1], unpack(args))
end
diff --git a/core/keys.lua b/core/keys.lua
index 5a60b3ee..b693d523 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -129,7 +129,6 @@ local ALT = 'a'..ADD
-- Optimize for speed.
local string = _G.string
local string_char = string.char
-local string_format = string.format
local xpcall = _G.xpcall
local next = _G.next
local type = _G.type
@@ -168,7 +167,7 @@ local keychain = {}
-- Clears the current key sequence.
local function clear_key_sequence()
- keychain = {}
+ if #keychain > 0 then keychain = {} end
gui.statusbar_text = ''
end
@@ -234,7 +233,7 @@ local function keypress(code, shift, control, alt)
control = control and CTRL or ''
shift = shift and SHIFT or ''
alt = alt and ALT or ''
- local key_seq = string_format('%s%s%s%s', control, shift, alt, key)
+ local key_seq = control..shift..alt..key
if #keychain > 0 and key_seq == keys.clear_sequence then
clear_key_sequence()