changes.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. diff -Naurp ./a/core/events.lua ./b/core/events.lua
  2. --- ./a/core/events.lua 2019-12-31 21:52:44.000000000 +0600
  3. +++ ./b/core/events.lua 2020-01-31 04:56:29.030105291 +0600
  4. @@ -410,6 +410,7 @@ local textadept_events = {
  5. 'initialized', 'keypress', 'menu_clicked', 'mouse', 'quit', 'replace',
  6. 'replace_all', 'reset_after', 'reset_before', 'resume', 'suspend',
  7. 'tab_clicked', 'view_after_switch', 'view_before_switch', 'view_new'
  8. + , 'tab_middle_click', 'tab_middle_click_blank', 'tab_double_click_blank'
  9. }
  10. for _, e in pairs(textadept_events) do M[e:upper()] = e end
  11. diff -Naurp ./a/modules/textadept/find.lua ./b/modules/textadept/find.lua
  12. --- ./a/modules/textadept/find.lua 2019-12-31 21:52:44.000000000 +0600
  13. +++ ./b/modules/textadept/find.lua 2020-01-31 04:58:51.802813262 +0600
  14. @@ -431,7 +431,7 @@ function M.goto_file_found(line_num, nex
  15. else
  16. s, e = 0, 0 -- binary file notice, or highlighting was somehow removed
  17. end
  18. - ui.goto_file(utf8_filename:iconv(_CHARSET, 'UTF-8'), true, preferred_view)
  19. + ui.goto_file(utf8_filename:iconv(_CHARSET, 'UTF-8'), false, preferred_view)
  20. textadept.editing.goto_line(line_num - 1)
  21. if buffer:line_from_position(buffer.current_pos + s) == line_num - 1 then
  22. buffer:set_sel(buffer.current_pos + e, buffer.current_pos + s)
  23. diff -Naurp ./a/src/textadept.c ./b/src/textadept.c
  24. --- ./a/src/textadept.c 2019-12-31 21:52:44.000000000 +0600
  25. +++ ./b/src/textadept.c 2020-01-31 06:17:20.218161000 +0600
  26. @@ -1231,9 +1231,20 @@ static int t_tabbuttonpress(GtkWidget *l
  27. event_mod(SHIFT), event_mod(CONTROL), event_mod(MOD1),
  28. event_mod(META), -1);
  29. if (event->button == 3) lL_showcontextmenu(lua, event, "tab_context_menu");
  30. + // Custom event for middle click on a tab
  31. + if (event->button == 2) lL_event(lua, "tab_middle_click", -1);
  32. }
  33. return TRUE;
  34. }
  35. +
  36. +/** Custom signal for a tabbar (empty space) mouse click. */
  37. +static int t_tabbarbuttonpress(GtkWidget *label, GdkEventButton *event, void*__) {
  38. + // Custom event for middle click on blank space on tab bar
  39. + if (event->button == 2) lL_event(lua, "tab_middle_click_blank", -1);
  40. + // Custom event for double click on blank space on tab bar
  41. + if (event->type == GDK_2BUTTON_PRESS) lL_event(lua, "tab_double_click_blank", -1);
  42. + return TRUE;
  43. +}
  44. #endif
  45. /** `buffer.__index` and `buffer.__newindex` Lua metamethods. */
  46. @@ -1292,6 +1303,8 @@ static int lbuf_property(lua_State *L) {
  47. lua_getfield(L, 1, "tab_pointer");
  48. #if GTK
  49. GtkNotebook *tabs = GTK_NOTEBOOK(tabbar);
  50. + // Custom events for button clicks on tabbar (empty space)
  51. + signal(tabs, "button-press-event", t_tabbarbuttonpress);
  52. GtkWidget *tab = (GtkWidget *)lua_touserdata(L, -1);
  53. lua_pushstring(L, gtk_notebook_get_tab_label_text(tabs, tab));
  54. if (newindex) {