diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2011-09-21 18:03:49 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2011-09-21 18:03:49 -0400 |
commit | 8461d29251895160755695b74ca6356a9cd8e6f3 (patch) | |
tree | 7b10a1ba21c8764387d599583d1c476752380706 /core | |
parent | 7b7b3ec22ae5d64c08c945abc80f2ad27a1692b3 (diff) |
Emit 'SCN' on SCNotification instead of calling events.notification().
Diffstat (limited to 'core')
-rw-r--r-- | core/events.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/events.lua b/core/events.lua index 876d0116..a67dde9d 100644 --- a/core/events.lua +++ b/core/events.lua @@ -243,7 +243,7 @@ end --- Map of Scintilla notifications to their handlers. local c = _SCINTILLA.constants -local scnnotifications = { +local scnotifications = { [c.SCN_CHARADDED] = { 'char_added', 'ch' }, [c.SCN_SAVEPOINTREACHED] = { 'save_point_reached' }, [c.SCN_SAVEPOINTLEFT] = { 'save_point_left' }, @@ -269,20 +269,17 @@ local scnnotifications = { [c.SCN_HOTSPOTRELEASECLICK] = { 'hotspot_release_click', 'position' }, } ---- -- Handles Scintilla notifications. --- @param n The Scintilla notification structure as a Lua table. --- @return true or false if any handler explicitly returned such; nil otherwise. -function notification(n) - local f = scnnotifications[n.code] +connect('SCN', function(n) + local f = scnotifications[n.code] if not f then return end local args = {} for i = 2, #f do args[i - 1] = n[f[i]] end return emit(f[1], unpack(args)) -end +end) -- Set event constants. -for _, n in pairs(scnnotifications) do _M[n[1]:upper()] = n[1] end +for _, n in pairs(scnotifications) do _M[n[1]:upper()] = n[1] end local ta_events = { 'appleevent_odoc', 'buffer_after_switch', 'buffer_before_switch', 'buffer_deleted', 'buffer_new', 'command_entry_command', |