aboutsummaryrefslogtreecommitdiff
path: root/core/events.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2014-10-25 00:30:36 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2014-10-25 00:30:36 -0400
commit83c20c89439386f31050718c94551d863298cdb9 (patch)
tree536dd52392df00ded7bbc5f650ea0eb0d397d52d /core/events.lua
parent1de8c1bb596a7dbff39ab55685ead31a5d0c9373 (diff)
downloadtextadept-83c20c89439386f31050718c94551d863298cdb9.tar.gz
textadept-83c20c89439386f31050718c94551d863298cdb9.zip
Improvements to terminal mouse handling.
Emit events for unhandled mouse events and connect to such events in order to focus and resize views. Patch libtermkey with new Win32 PDCurses driver for unified key/mouse input. Update CDK patch to always use libtermkey and to ignore mouse events. Requires Scinterm r97 (changeset 8d1a625c9b4d). Thanks to Chris Emerson for proof of concept code that handles mouse events and for the code that focuses and resizes views.
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/core/events.lua b/core/events.lua
index 56331196..c63e98a8 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -192,6 +192,18 @@ local M = {}
-- Arguments:
--
-- * _`menu_id`_: The numeric ID of the menu item set in [`ui.menu()`]().
+-- @field MOUSE (string)
+-- Emitted by the terminal version for an unhandled mouse event.
+-- Arguments:
+--
+-- * _`event`_: The mouse event: `buffer.MOUSE_PRESS`, `buffer.MOUSE_DRAG`, or
+-- `buffer.MOUSE_RELEASE`.
+-- * _`button`_: The mouse button number.
+-- * _`y`_: The y-coordinate of the mouse event, starting from 1.
+-- * _`x`_: The x-coordinate of the mouse event, starting from 1.
+-- * _`shift`_: The "Shift" modifier key is held down.
+-- * _`ctrl`_: The "Control" modifier key is held down.
+-- * _`alt`_: The "Alt"/"Option" modifier key is held down.
-- @field QUIT (string)
-- Emitted when quitting Textadept.
-- When connecting to this event, connect with an index of 1 or the handler
@@ -366,9 +378,9 @@ 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', 'csi', 'error', 'find', 'focus',
- 'initialized', 'keypress', 'menu_clicked', 'quit', 'replace', 'replace_all',
- 'reset_after', 'reset_before', 'view_after_switch', 'view_before_switch',
- 'view_new'
+ 'initialized', 'keypress', 'menu_clicked', 'mouse', 'quit', 'replace',
+ 'replace_all', 'reset_after', 'reset_before', 'view_after_switch',
+ 'view_before_switch', 'view_new'
}
for _, e in pairs(ta_events) do M[e:upper()] = e end