From 51d40f28fcffc683919f8ff6e376d4820eef2cbf Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 13 Nov 2019 20:54:52 -0500 Subject: Make new arguments to `events.TAB_CLICKED` backwards-compatible. --- core/events.lua | 2 +- core/ui.lua | 2 +- src/textadept.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/events.lua b/core/events.lua index 768f41e0..d83c7803 100644 --- a/core/events.lua +++ b/core/events.lua @@ -246,10 +246,10 @@ local M = {} -- Note that Textadept always displays a context menu on right-click. -- Arguments: -- +-- * _`index`_: The numeric index of the clicked tab. -- * _`button`_: The mouse button number that was clicked, either `1` (left -- button), `2` (middle button), `3` (right button), `4` (wheel up), or `5` -- (wheel down). --- * _`index`_: The numeric index of the clicked tab. -- * _`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. diff --git a/core/ui.lua b/core/ui.lua index b0cce5d7..aa3e29e0 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -278,7 +278,7 @@ events_connect(events.VIEW_NEW, function() events.emit(events.UPDATE_UI) end) -- Switches between buffers when a tab is clicked. events_connect(events.TAB_CLICKED, - function(button, index) view:goto_buffer(_BUFFERS[index]) end) + function(index, button) view:goto_buffer(_BUFFERS[index]) end) -- Sets the title of the Textadept window to the buffer's filename. local function set_title() diff --git a/src/textadept.c b/src/textadept.c index 7f41693a..e8a87678 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1227,7 +1227,7 @@ static int t_tabbuttonpress(GtkWidget *label, GdkEventButton *event, void*__) { for (int i = 0; i < gtk_notebook_get_n_pages(tabs); i++) { GtkWidget *page = gtk_notebook_get_nth_page(tabs, i); if (label != gtk_notebook_get_tab_label(tabs, page)) continue; - lL_event(lua, "tab_clicked", LUA_TNUMBER, event->button, LUA_TNUMBER, i + 1, + lL_event(lua, "tab_clicked", LUA_TNUMBER, i + 1, LUA_TNUMBER, event->button, event_mod(SHIFT), event_mod(CONTROL), event_mod(MOD1), event_mod(META), -1); if (event->button == 3) lL_showcontextmenu(lua, event, "tab_context_menu"); @@ -1855,7 +1855,7 @@ static void w_quit_osx(GtkosxApplication*_, void*__) { */ static void t_tabchange(GtkNotebook*_, GtkWidget*__, int page_num, void*___) { if (tab_sync) return; - lL_event(lua, "tab_clicked", LUA_TNUMBER, 1, LUA_TNUMBER, page_num + 1, -1); + lL_event(lua, "tab_clicked", LUA_TNUMBER, page_num + 1, LUA_TNUMBER, 1, -1); } #endif // if GTK -- cgit v1.2.3