diff options
Diffstat (limited to 'core/events.lua')
-rw-r--r-- | core/events.lua | 186 |
1 files changed, 96 insertions, 90 deletions
diff --git a/core/events.lua b/core/events.lua index c939e0db..02a1dcc5 100644 --- a/core/events.lua +++ b/core/events.lua @@ -36,7 +36,7 @@ module('events')]] -- -- * `APPLEEVENT_ODOC` -- Called when Mac OSX tells Textadept to open a document. --- * `uri`: The URI to open encoded in UTF-8. +-- * `uri`: The URI to open encoded in UTF-8. -- * `AUTO_C_CHAR_DELETED` -- Called when the user deleted a character while the autocompletion list was -- active. @@ -45,10 +45,11 @@ module('events')]] -- * `AUTO_C_SELECTION` -- Called when the user has selected an item in an autocompletion list and -- before the selection is inserted. --- Automatic insertion can be cancelled by calling `buffer:auto_c_cancel()` --- before returning from the event handler. Arguments: --- * `text`: The text of the selection. --- * `position`: The start position of the word being completed. +-- Automatic insertion can be cancelled by calling +-- [`buffer:auto_c_cancel()`][] before returning from the event handler. +-- Arguments: +-- * `text`: The text of the selection. +-- * `position`: The start position of the word being completed. -- * `BUFFER_AFTER_SWITCH` -- Called right after a buffer is switched to. -- * `BUFFER_BEFORE_SWITCH` @@ -60,134 +61,134 @@ module('events')]] -- * `CALL_TIP_CLICK` -- Called when the user clicks on a calltip. -- Arguments: --- * `position`: Set to 1 if the click is in an up arrow, 2 if in a down --- arrow, and 0 if elsewhere. +-- * `position`: Set to 1 if the click is in an up arrow, 2 if in a down +-- arrow, and 0 if elsewhere. -- * `CHAR_ADDED` -- Called when an ordinary text character is added to the buffer. -- Arguments: --- * `ch`: The text character byte. +-- * `ch`: The text character byte. -- * `COMMAND_ENTRY_COMMAND` -- Called when a command is entered into the Command Entry. -- Arguments: --- * `command`: The command text. +-- * `command`: The command text. -- * `COMMAND_ENTRY_KEYPRESS` -- Called when a key is pressed in the Command Entry. -- Arguments: --- * `code`: The key code. --- * `shift`: The Shift key is held down. --- * `ctrl`: The Control/Command key is held down. --- * `alt`: The Alt/option key is held down. --- * `meta`: The Control key on Mac OSX is held down. +-- * `code`: The key code. +-- * `shift`: The Shift key is held down. +-- * `ctrl`: The Control/Command key is held down. +-- * `alt`: The Alt/option key is held down. +-- * `meta`: The Control key on Mac OSX is held down. -- * `DOUBLE_CLICK` -- Called when the mouse button is double-clicked. -- Arguments: --- * `position`: The text position of the double click. --- * `line`: The line of the double click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. +-- * `position`: The text position of the double click. +-- * `line`: The line of the double click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero +-- or more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK. -- * `DWELL_END` -- Called after a `DWELL_START` and the mouse is moved or other activity such -- as key press indicates the dwell is over. -- Arguments: --- * `position`: The nearest position in the document to the position --- where the mouse pointer was lingering. --- * `x`: Where the pointer lingered. --- * `y`: Where the pointer lingered. +-- * `position`: The nearest position in the document to the position where +-- the mouse pointer was lingering. +-- * `x`: Where the pointer lingered. +-- * `y`: Where the pointer lingered. -- * `DWELL_START` -- Called when the user keeps the mouse in one position for the dwell period -- (see `_SCINTILLA.constants.SCI_SETMOUSEDWELLTIME`). -- Arguments: --- * `position`: The nearest position in the document to the position --- where the mouse pointer was lingering. --- * `x`: Where the pointer lingered. --- * `y`: Where the pointer lingered. +-- * `position`: The nearest position in the document to the position where +-- the mouse pointer was lingering. +-- * `x`: Where the pointer lingered. +-- * `y`: Where the pointer lingered. -- * `ERROR` -- Called when an error occurs. -- Arguments: --- * `text`: The error text. +-- * `text`: The error text. -- * `FIND` -- Called when finding text via the Find dialog box. -- Arguments: --- * `text`: The text to search for. --- * `next`: Search forward. +-- * `text`: The text to search for. +-- * `next`: Search forward. -- * `HOTSPOT_CLICK` -- Called when the user clicks on text that is in a style with the hotspot -- attribute set. -- Arguments: --- * `position`: The text position of the click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. +-- * `position`: The text position of the click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero +-- or more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK. -- * `HOTSPOT_DOUBLE_CLICK` -- Called when the user double clicks on text that is in a style with the -- hotspot attribute set. -- Arguments: --- * `position`: The text position of the double click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. +-- * `position`: The text position of the double click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero +-- or more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK. -- * `HOTSPOT_RELEASE_CLICK` -- Called when the user releases the mouse on text that is in a style with the -- hotspot attribute set. -- Arguments: --- * `position`: The text position of the release. +-- * `position`: The text position of the release. -- * `INDICATOR_CLICK` -- Called when the user clicks the mouse on text that has an indicator. -- Arguments: --- * `position`: The text position of the click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. +-- * `position`: The text position of the click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero +-- or more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK. -- * `INDICATOR_RELEASE` -- Called when the user releases the mouse on text that has an indicator. -- Arguments: --- * `position`: The text position of the release. +-- * `position`: The text position of the release. -- * `KEYPRESS` -- Called when a key is pressed. -- Arguments: --- * `code`: The key code. --- * `shift`: The Shift key is held down. --- * `ctrl`: The Control/Command key is held down. --- * `alt`: The Alt/option key is held down. --- * `meta`: The Control key on Mac OSX is held down. +-- * `code`: The key code. +-- * `shift`: The Shift key is held down. +-- * `ctrl`: The Control/Command key is held down. +-- * `alt`: The Alt/option key is held down. +-- * `meta`: The Control key on Mac OSX is held down. -- * `MARGIN_CLICK` -- Called when the mouse is clicked inside a margin. -- Arguments: --- * `margin`: The margin number that was clicked. --- * `position`: The position of the start of the line in the buffer that --- corresponds to the margin click. --- * `modifiers`: The appropriate combination of --- `_SCINTILLA.constants.SCI_SHIFT`, `_SCINTILLA.constants.SCI_CTRL`, --- and `_SCINTILLA.constants.SCI_ALT` to indicate the keys that were --- held down at the time of the margin click. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. +-- * `margin`: The margin number that was clicked. +-- * `position`: The position of the start of the line in the buffer that +-- corresponds to the margin click. +-- * `modifiers`: The appropriate combination of +-- `_SCINTILLA.constants.SCI_SHIFT`, `_SCINTILLA.constants.SCI_CTRL`, +-- and `_SCINTILLA.constants.SCI_ALT` to indicate the keys that were +-- held down at the time of the margin click. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK. -- * `MENU_CLICKED` -- Called when a menu item is selected. -- Arguments: --- * `menu_id`: The numeric ID of the menu item set in `gui.gtkmenu()`. +-- * `menu_id`: The numeric ID of the menu item set in [`gui.gtkmenu()`][]. -- * `QUIT` -- Called when quitting Textadept. -- When connecting to this event, connect with an index of 1 or the handler @@ -195,18 +196,18 @@ module('events')]] -- * `REPLACE` -- Called to replace selected (found) text. -- Arguments: --- * `text`: The text to replace selected text with. +-- * `text`: The text to replace selected text with. -- * `REPLACE_ALL` -- Called to replace all occurances of found text. -- Arguments: --- * `find_text`: The text to search for. --- * `repl_text`: The text to replace found text with. +-- * `find_text`: The text to search for. +-- * `repl_text`: The text to replace found text with. -- * `RESET_AFTER` -- Called after resetting the Lua state. --- This is triggered by `reset()`. +-- This is triggered by [`reset()`][]. -- * `RESET_BEFORE` -- Called before resetting the Lua state. --- This is triggered by `reset()`. +-- This is triggered by [`reset()`][]. -- * `SAVE_POINT_LEFT` -- Called when a save point is left. -- * `SAVE_POINT_REACHED` @@ -217,14 +218,14 @@ module('events')]] -- * `URI_DROPPED` -- Called when the user has dragged a URI such as a file name onto the view. -- Arguments: --- * `text`: The URI text encoded in UTF-8. +-- * `text`: The URI text encoded in UTF-8. -- * `USER_LIST_SELECTION` -- Called when the user has selected an item in a user list. -- Arguments: --- * `list_type`: This is set to the list_type parameter from the --- `buffer:user_list_show()` call that initiated the list. --- * `text`: The text of the selection. --- * `position`: The position the list was displayed at. +-- * `list_type`: This is set to the list_type parameter from the +-- [`buffer:user_list_show()`][] call that initiated the list. +-- * `text`: The text of the selection. +-- * `position`: The position the list was displayed at. -- * `VIEW_NEW` -- Called when a new view is created. -- * `VIEW_BEFORE_SWITCH` @@ -232,6 +233,11 @@ module('events')]] -- * `VIEW_AFTER_SWITCH` -- Called right after another view is switched to. -- +-- [`buffer:auto_c_cancel()`]: buffer.html#buffer.auto_c_cancel +-- [`gui.gtkmenu()`]: gui.html#gtkmenu +-- [`reset()`]: _G.html#reset +-- [`buffer:user_list_show()`]: buffer.html#buffer.user_list_show +-- -- ## Example -- -- The following Lua code generates and handles a custom `my_event` event: |