aboutsummaryrefslogtreecommitdiff
path: root/core/events.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-07-24 15:40:55 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-07-24 15:40:55 -0400
commite9474c8c82745d82ffb39ff1618a96b10f724077 (patch)
treec4955dbf53e73e050b132da79a9ecd5b3aa55530 /core/events.lua
parent74049a11517ffb608bf64aabcc96535d1bc7b298 (diff)
downloadtextadept-e9474c8c82745d82ffb39ff1618a96b10f724077.tar.gz
textadept-e9474c8c82745d82ffb39ff1618a96b10f724077.zip
Added `events.TAB_CLICKED` event.
This allows for the user to override the default switch behavior (e.g. switch to an existing split view that already has the target buffer open). Thanks to Gabriel Dubatti.
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/events.lua b/core/events.lua
index 849c4302..dcaf5716 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -218,6 +218,13 @@ local M = {}
-- Emitted when suspending Textadept. If any handler returns `true`, Textadept
-- does not suspend.
-- This event is only emitted by the terminal version.
+-- @field TAB_CLICKED (string)
+-- Emitted when the user clicks on a buffer tab.
+-- When connecting to this event, connect with an index of 1 if the handler
+-- needs to run before Textadept switches between buffers.
+-- Arguments:
+--
+-- * _`index`_: The numeric index of the clicked tab.
-- @field UPDATE_UI (string)
-- Emitted after the view is visually updated.
-- Arguments:
@@ -366,7 +373,7 @@ local textadept_events = {
'buffer_deleted', 'buffer_new', 'csi', 'error', 'find', 'focus',
'initialized', 'keypress', 'menu_clicked', 'mouse', 'quit', 'replace',
'replace_all', 'reset_after', 'reset_before', 'resume', 'suspend',
- 'view_after_switch', 'view_before_switch', 'view_new'
+ 'tab_clicked', 'view_after_switch', 'view_before_switch', 'view_new'
}
for _, e in pairs(textadept_events) do M[e:upper()] = e end