aboutsummaryrefslogtreecommitdiff
path: root/core/ui.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/ui.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/ui.lua')
-rw-r--r--core/ui.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/ui.lua b/core/ui.lua
index a30b5e7a..06d68776 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -302,6 +302,10 @@ events_connect(events.BUFFER_NEW, function()
buffer:private_lexer_call(SETLEXERLANGUAGE, 'text')
end)
+-- Switches between buffers when a tab is clicked.
+events_connect(events.TAB_CLICKED,
+ function(index) view:goto_buffer(_BUFFERS[index]) end)
+
-- Sets the title of the Textadept window to the buffer's filename.
local function set_title()
local filename = buffer.filename or buffer._type or _L['Untitled']