From 83031f9516fd5004e1433c9d10edd1d06f3f8ba0 Mon Sep 17 00:00:00 2001 From: laelnasan Date: Thu, 19 Nov 2020 13:44:04 -0300 Subject: [PATCH 1/9] mouseable views --- src/ltui/action.lua | 1 + src/ltui/application.lua | 10 +++++++++- src/ltui/boxdialog.lua | 30 ++++++++++++++++++++++++++++++ src/ltui/button.lua | 17 +++++++++++++++++ src/ltui/panel.lua | 36 ++++++++++++++++++++++++++++++++++++ src/ltui/program.lua | 1 + 6 files changed, 94 insertions(+), 1 deletion(-) diff --git a/src/ltui/action.lua b/src/ltui/action.lua index 20618a7..82a90b6 100644 --- a/src/ltui/action.lua +++ b/src/ltui/action.lua @@ -40,6 +40,7 @@ end action:register("ac_max", "ac_on_text_changed", "ac_on_selected", + "ac_on_clicked", "ac_on_resized", "ac_on_enter", "ac_on_load", diff --git a/src/ltui/application.lua b/src/ltui/application.lua index 54085af..04c7f92 100644 --- a/src/ltui/application.lua +++ b/src/ltui/application.lua @@ -85,7 +85,15 @@ end -- on event function application:on_event(e) - program.on_event(self, e) + if (not program.on_event(self, e)) and curses.KEY_MOUSE then + + -- mouse events + if e.type == ltui.event.ev_mouse and ( + e.btn_name == "BUTTON1_CLICKED" or + e.btn_name == "BUTTON1_DOUBLE_CLICKED") then + self:action_on(ltui.action.ac_on_clicked, e.x, e.y) + end + end end -- on resize diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index 1b1be6c..d9ab03f 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -64,6 +64,36 @@ function boxdialog:init(name, bounds, title) self:text():bounds().ey = self._TEXT_EY self:box():bounds_set(rect{0, self._TEXT_EY, v:width(), v:height() - 1}) end) + + if curses.KEY_MOUSE then + + -- set click action + self:frame():action_set(ltui.action.ac_on_clicked, function (v, x, y) + + -- return if not mouseable + if not v:option("mouseable") then + return + end + + -- get relative coordinates + x, y = x - v:bounds().sx, y - v:bounds().sy + + local panel, box = v:parent():panel(), v:parent():box() + local px, py = x - panel:bounds().sx, y - panel:bounds().sy + + -- if coordinates don't match any view try box + if panel:action_on(ltui.action.ac_on_clicked, x, y) and + (not box:option("selectable")) and + box:bounds():contains(px, py) then + + -- bypass panel + return box:action_on(ltui.action.ac_on_clicked, px, py) + end + + -- return true if it doesn't match any selectable view + return true + end) + end end -- get box diff --git a/src/ltui/button.lua b/src/ltui/button.lua index 56ae916..ca688d9 100644 --- a/src/ltui/button.lua +++ b/src/ltui/button.lua @@ -38,6 +38,23 @@ function button:init(name, bounds, text, on_action) -- mark as selectable self:option_set("selectable", true) + -- mark as mouseable + self:option_set("mouseable", true) + + -- set click action + self:action_set(ltui.action.ac_on_clicked, function (v) + + -- return if not mouseable + if not v:option("mouseable") then + return + end + + if v:parent()._do_select then + return v:parent():_do_select() + end + return v:action_on(ltui.action.ac_on_enter) + end) + -- show cursor self:cursor_show(true) diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index e830702..d105287 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -26,6 +26,7 @@ local event = require("ltui/event") local point = require("ltui/point") local curses = require("ltui/curses") local dlist = require("ltui/base/dlist") +local action = require("ltui/action") -- define module local panel = panel or view() @@ -47,6 +48,41 @@ function panel:init(name, bounds) -- init views cache self._VIEWS_CACHE = {} + + if curses.KEY_MOUSE then + + -- mark as mouseable + self:option_set("mouseable", true) + + -- set click action + self:action_set(action.ac_on_clicked, function (v, x, y) + + -- return if not clickable + if not v:option("mouseable") then + return + end + + -- get relative coordinates + x, y = x - v:bounds().sx, y - v:bounds().sy + + -- try focused first + if v:current() and v:current():bounds():contains(x, y) then + return v:current():action_on(ltui.action.ac_on_clicked, x, y) + end + + local p = v:last() + while p do + if p:option('selectable') and p:bounds():contains(x, y) then + v:select(p) + return p:action_on(action.ac_on_clicked, x, y) + end + p = v:prev(p) + end + + -- return true if does not match any selectable view + return true + end) + end end -- get all child views diff --git a/src/ltui/program.lua b/src/ltui/program.lua index 7046274..61e90c2 100644 --- a/src/ltui/program.lua +++ b/src/ltui/program.lua @@ -46,6 +46,7 @@ function program:init(name, argv) -- init mouse support if curses.KEY_MOUSE then + -- curses.ALL_MOUSE_EVENTS may be set to mask unused events curses.mousemask(curses.ALL_MOUSE_EVENTS) end From a1f1acff401211e4aa62d7a3dcaf5cf7379fbb4a Mon Sep 17 00:00:00 2001 From: laelnasan Date: Thu, 19 Nov 2020 13:53:39 -0300 Subject: [PATCH 2/9] mouseable views - correction --- src/ltui/boxdialog.lua | 4 ++-- src/ltui/button.lua | 37 ++++++++++++++++++++----------------- src/ltui/panel.lua | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index d9ab03f..184b9e8 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -68,7 +68,7 @@ function boxdialog:init(name, bounds, title) if curses.KEY_MOUSE then -- set click action - self:frame():action_set(ltui.action.ac_on_clicked, function (v, x, y) + self:frame():action_set(action.ac_on_clicked, function (v, x, y) -- return if not mouseable if not v:option("mouseable") then @@ -87,7 +87,7 @@ function boxdialog:init(name, bounds, title) box:bounds():contains(px, py) then -- bypass panel - return box:action_on(ltui.action.ac_on_clicked, px, py) + return box:action_on(action.ac_on_clicked, px, py) end -- return true if it doesn't match any selectable view diff --git a/src/ltui/button.lua b/src/ltui/button.lua index ca688d9..d6858ac 100644 --- a/src/ltui/button.lua +++ b/src/ltui/button.lua @@ -38,28 +38,31 @@ function button:init(name, bounds, text, on_action) -- mark as selectable self:option_set("selectable", true) - -- mark as mouseable - self:option_set("mouseable", true) - - -- set click action - self:action_set(ltui.action.ac_on_clicked, function (v) - - -- return if not mouseable - if not v:option("mouseable") then - return - end - - if v:parent()._do_select then - return v:parent():_do_select() - end - return v:action_on(ltui.action.ac_on_enter) - end) - -- show cursor self:cursor_show(true) -- init action self:action_set(action.ac_on_enter, on_action) + + if curses.KEY_MOUSE then + + -- mark as mouseable + self:option_set("mouseable", true) + + -- set click action + self:action_set(action.ac_on_clicked, function (v) + + -- return if not mouseable + if not v:option("mouseable") then + return + end + + if v:parent()._do_select then + return v:parent():_do_select() + end + return v:action_on(action.ac_on_enter) + end) + end end -- draw button diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index d105287..89da183 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -67,7 +67,7 @@ function panel:init(name, bounds) -- try focused first if v:current() and v:current():bounds():contains(x, y) then - return v:current():action_on(ltui.action.ac_on_clicked, x, y) + return v:current():action_on(action.ac_on_clicked, x, y) end local p = v:last() From be0060b4655149878f927c7a8fcb2c8d2bb5f4fb Mon Sep 17 00:00:00 2001 From: laelnasan Date: Thu, 19 Nov 2020 14:17:31 -0300 Subject: [PATCH 3/9] mouseable views - correction 2 --- src/core/lcurses/lcurses.c | 1 + src/ltui/application.lua | 5 +++-- src/ltui/boxdialog.lua | 5 +---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/lcurses/lcurses.c b/src/core/lcurses/lcurses.c index eb2786e..4cced2b 100644 --- a/src/core/lcurses/lcurses.c +++ b/src/core/lcurses/lcurses.c @@ -65,6 +65,7 @@ Notes: #ifndef LUAJIT # define LUA_COMPAT_5_1 +# define LUA_COMPAT_5_3 # define LUA_COMPAT_ALL #endif #include "luaconf.h" diff --git a/src/ltui/application.lua b/src/ltui/application.lua index 04c7f92..1b44da7 100644 --- a/src/ltui/application.lua +++ b/src/ltui/application.lua @@ -28,6 +28,7 @@ local program = require("ltui/program") local desktop = require("ltui/desktop") local menubar = require("ltui/menubar") local statusbar = require("ltui/statusbar") +local action = require("ltui/action") -- define module local application = application or program() @@ -88,10 +89,10 @@ function application:on_event(e) if (not program.on_event(self, e)) and curses.KEY_MOUSE then -- mouse events - if e.type == ltui.event.ev_mouse and ( + if e.type == event.ev_mouse and ( e.btn_name == "BUTTON1_CLICKED" or e.btn_name == "BUTTON1_DOUBLE_CLICKED") then - self:action_on(ltui.action.ac_on_clicked, e.x, e.y) + self:action_on(action.ac_on_clicked, e.x, e.y) end end end diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index 184b9e8..509b49a 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -82,16 +82,13 @@ function boxdialog:init(name, bounds, title) local px, py = x - panel:bounds().sx, y - panel:bounds().sy -- if coordinates don't match any view try box - if panel:action_on(ltui.action.ac_on_clicked, x, y) and + if panel:action_on(action.ac_on_clicked, x, y) and (not box:option("selectable")) and box:bounds():contains(px, py) then -- bypass panel return box:action_on(action.ac_on_clicked, px, py) end - - -- return true if it doesn't match any selectable view - return true end) end end From 078b76500c76d3e1dddcc05d6a586107c70500e8 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 20 Nov 2020 22:48:28 +0800 Subject: [PATCH 4/9] fix codestyle for mouse --- src/ltui/application.lua | 11 +-------- src/ltui/boxdialog.lua | 35 +++++++++++------------------ src/ltui/button.lua | 30 ++++++++----------------- src/ltui/panel.lua | 48 ++++++++++++++++------------------------ src/ltui/program.lua | 6 +++++ src/ltui/view.lua | 1 + 6 files changed, 49 insertions(+), 82 deletions(-) diff --git a/src/ltui/application.lua b/src/ltui/application.lua index 1b44da7..54085af 100644 --- a/src/ltui/application.lua +++ b/src/ltui/application.lua @@ -28,7 +28,6 @@ local program = require("ltui/program") local desktop = require("ltui/desktop") local menubar = require("ltui/menubar") local statusbar = require("ltui/statusbar") -local action = require("ltui/action") -- define module local application = application or program() @@ -86,15 +85,7 @@ end -- on event function application:on_event(e) - if (not program.on_event(self, e)) and curses.KEY_MOUSE then - - -- mouse events - if e.type == event.ev_mouse and ( - e.btn_name == "BUTTON1_CLICKED" or - e.btn_name == "BUTTON1_DOUBLE_CLICKED") then - self:action_on(action.ac_on_clicked, e.x, e.y) - end - end + program.on_event(self, e) end -- on resize diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index 509b49a..f27f0ac 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -65,32 +65,23 @@ function boxdialog:init(name, bounds, title) self:box():bounds_set(rect{0, self._TEXT_EY, v:width(), v:height() - 1}) end) - if curses.KEY_MOUSE then + -- on click for frame + self:frame():action_set(action.ac_on_clicked, function (v, x, y) - -- set click action - self:frame():action_set(action.ac_on_clicked, function (v, x, y) + -- get relative coordinates + x, y = x - v:bounds().sx, y - v:bounds().sy + local panel, box = v:parent():panel(), v:parent():box() + local px, py = x - panel:bounds().sx, y - panel:bounds().sy - -- return if not mouseable - if not v:option("mouseable") then - return - end - - -- get relative coordinates - x, y = x - v:bounds().sx, y - v:bounds().sy - - local panel, box = v:parent():panel(), v:parent():box() - local px, py = x - panel:bounds().sx, y - panel:bounds().sy - - -- if coordinates don't match any view try box - if panel:action_on(action.ac_on_clicked, x, y) and - (not box:option("selectable")) and - box:bounds():contains(px, py) then - - -- bypass panel + -- if coordinates don't match any view try box + if panel:option("mouseable") then + if panel:action_on(action.ac_on_clicked, x, y) then + return true + elseif box:option("mouseable") and not box:option("selectable") and box:bounds():contains(px, py) then return box:action_on(action.ac_on_clicked, px, py) end - end) - end + end + end) end -- get box diff --git a/src/ltui/button.lua b/src/ltui/button.lua index d6858ac..7cd9776 100644 --- a/src/ltui/button.lua +++ b/src/ltui/button.lua @@ -41,28 +41,16 @@ function button:init(name, bounds, text, on_action) -- show cursor self:cursor_show(true) - -- init action + -- init actions self:action_set(action.ac_on_enter, on_action) - - if curses.KEY_MOUSE then - - -- mark as mouseable - self:option_set("mouseable", true) - - -- set click action - self:action_set(action.ac_on_clicked, function (v) - - -- return if not mouseable - if not v:option("mouseable") then - return - end - - if v:parent()._do_select then - return v:parent():_do_select() - end - return v:action_on(action.ac_on_enter) - end) - end + self:action_set(action.ac_on_clicked, function (v) + -- FIXME + if v:parent()._do_select then + v:parent():_do_select() + end + v:action_on(action.ac_on_enter) + return true + end) end -- draw button diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index 89da183..5775b8e 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -49,40 +49,30 @@ function panel:init(name, bounds) -- init views cache self._VIEWS_CACHE = {} - if curses.KEY_MOUSE then + -- on click action + self:action_set(action.ac_on_clicked, function (v, x, y) - -- mark as mouseable - self:option_set("mouseable", true) + -- get relative coordinates + x, y = x - v:bounds().sx, y - v:bounds().sy - -- set click action - self:action_set(action.ac_on_clicked, function (v, x, y) + -- try focused first + local current = v:current() + if current and current:option("mouseable") and current:bounds():contains(x, y) then + return current:action_on(action.ac_on_clicked, x, y) + end - -- return if not clickable - if not v:option("mouseable") then - return - end - - -- get relative coordinates - x, y = x - v:bounds().sx, y - v:bounds().sy - - -- try focused first - if v:current() and v:current():bounds():contains(x, y) then - return v:current():action_on(action.ac_on_clicked, x, y) - end - - local p = v:last() - while p do - if p:option('selectable') and p:bounds():contains(x, y) then - v:select(p) - return p:action_on(action.ac_on_clicked, x, y) + local p = v:last() + while p do + if p:option('selectable') and p:bounds():contains(x, y) then + v:select(p) + if p:option("mouseable") then + p:action_on(action.ac_on_clicked, x, y) end - p = v:prev(p) + return true end - - -- return true if does not match any selectable view - return true - end) - end + p = v:prev(p) + end + end) end -- get all child views diff --git a/src/ltui/program.lua b/src/ltui/program.lua index 61e90c2..e67bd1c 100644 --- a/src/ltui/program.lua +++ b/src/ltui/program.lua @@ -25,6 +25,7 @@ local point = require("ltui/point") local panel = require("ltui/panel") local event = require("ltui/event") local curses = require("ltui/curses") +local action = require("ltui/action") -- define module local program = program or panel() @@ -187,6 +188,11 @@ function program:on_event(e) elseif event.is_command(e, "cm_exit") then self:quit() return true + -- mouse events + elseif e.type == event.ev_mouse and self:option("mouseable") then + if e.btn_name == "BUTTON1_CLICKED" or e.btn_name == "BUTTON1_DOUBLE_CLICKED" then + self:action_on(action.ac_on_clicked, e.x, e.y) + end end end diff --git a/src/ltui/view.lua b/src/ltui/view.lua index d8e46b9..5eb6e75 100644 --- a/src/ltui/view.lua +++ b/src/ltui/view.lua @@ -68,6 +68,7 @@ function view:init(name, bounds) -- init options local options = object() options.selectable = false -- true if window can be selected + options.mouseable = curses.KEY_MOUSE and true or false -- enable it by default self._OPTIONS = options -- init attributes From 00b35c523c39e725245ce7f2baab3452d5f13ced Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Nov 2020 00:33:23 +0800 Subject: [PATCH 5/9] disable mouse for view by default --- src/ltui/boxdialog.lua | 1 + src/ltui/button.lua | 1 + src/ltui/curses.lua | 5 +++++ src/ltui/panel.lua | 1 + src/ltui/program.lua | 2 +- src/ltui/view.lua | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index f27f0ac..0e547fd 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -66,6 +66,7 @@ function boxdialog:init(name, bounds, title) end) -- on click for frame + self:option_set("mouseable", true) self:frame():action_set(action.ac_on_clicked, function (v, x, y) -- get relative coordinates diff --git a/src/ltui/button.lua b/src/ltui/button.lua index 7cd9776..1d18c16 100644 --- a/src/ltui/button.lua +++ b/src/ltui/button.lua @@ -42,6 +42,7 @@ function button:init(name, bounds, text, on_action) self:cursor_show(true) -- init actions + self:option_set("mouseable", true) self:action_set(action.ac_on_enter, on_action) self:action_set(action.ac_on_clicked, function (v) -- FIXME diff --git a/src/ltui/curses.lua b/src/ltui/curses.lua index 3ee6da1..6b55354 100644 --- a/src/ltui/curses.lua +++ b/src/ltui/curses.lua @@ -211,5 +211,10 @@ function curses.cursor_set(state) end end +-- has mouse? +function curses.has_mouse() + return curses.KEY_MOUSE and true or false +end + -- return module: curses return curses diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index 5775b8e..3a478c8 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -50,6 +50,7 @@ function panel:init(name, bounds) self._VIEWS_CACHE = {} -- on click action + self:option_set("mouseable", true) self:action_set(action.ac_on_clicked, function (v, x, y) -- get relative coordinates diff --git a/src/ltui/program.lua b/src/ltui/program.lua index e67bd1c..b3d9692 100644 --- a/src/ltui/program.lua +++ b/src/ltui/program.lua @@ -189,7 +189,7 @@ function program:on_event(e) self:quit() return true -- mouse events - elseif e.type == event.ev_mouse and self:option("mouseable") then + elseif e.type == event.ev_mouse and curses.has_mouse() and self:option("mouseable") then if e.btn_name == "BUTTON1_CLICKED" or e.btn_name == "BUTTON1_DOUBLE_CLICKED" then self:action_on(action.ac_on_clicked, e.x, e.y) end diff --git a/src/ltui/view.lua b/src/ltui/view.lua index 5eb6e75..9800553 100644 --- a/src/ltui/view.lua +++ b/src/ltui/view.lua @@ -68,7 +68,7 @@ function view:init(name, bounds) -- init options local options = object() options.selectable = false -- true if window can be selected - options.mouseable = curses.KEY_MOUSE and true or false -- enable it by default + options.mouseable = false -- false by default self._OPTIONS = options -- init attributes From ec90d4a2a71623679daa75c6b92a85df07cfd1a5 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Nov 2020 00:35:47 +0800 Subject: [PATCH 6/9] improve button/on_click --- src/ltui/button.lua | 4 ---- src/ltui/choicebox.lua | 7 ++++++- src/ltui/menuconf.lua | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ltui/button.lua b/src/ltui/button.lua index 1d18c16..aeaab56 100644 --- a/src/ltui/button.lua +++ b/src/ltui/button.lua @@ -45,10 +45,6 @@ function button:init(name, bounds, text, on_action) self:option_set("mouseable", true) self:action_set(action.ac_on_enter, on_action) self:action_set(action.ac_on_clicked, function (v) - -- FIXME - if v:parent()._do_select then - v:parent():_do_select() - end v:action_on(action.ac_on_enter) return true end) diff --git a/src/ltui/choicebox.lua b/src/ltui/choicebox.lua index e02626b..d0598a6 100644 --- a/src/ltui/choicebox.lua +++ b/src/ltui/choicebox.lua @@ -87,7 +87,12 @@ function choicebox:_do_insert(value, index, selected) local text = (selected and "(X) " or "( ) ") .. tostring(value) -- init a value item view - local item = button:new("choicebox.value." .. self:count(), rect:new(0, self:count(), self:width(), 1), text) + local item = button:new("choicebox.value." .. self:count(), + rect:new(0, self:count(), self:width(), 1), + text, + function (v, e) + self:_do_select() + end) -- attach this index item:extra_set("index", index) diff --git a/src/ltui/menuconf.lua b/src/ltui/menuconf.lua index 1f9983e..8709ae9 100644 --- a/src/ltui/menuconf.lua +++ b/src/ltui/menuconf.lua @@ -118,7 +118,12 @@ end function menuconf:_do_insert(config) -- init a config item view - local item = button:new("menuconf.config." .. self:count(), rect:new(0, self:count(), self:width(), 1), tostring(config)) + local item = button:new("menuconf.config." .. self:count(), + rect:new(0, self:count(), self:width(), 1), + tostring(config), + function (v, e) + self:_do_select() + end) -- attach this config item:extra_set("config", config) From 14fb32a16cc647bfd337053f5a027443245098ec Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Nov 2020 00:36:03 +0800 Subject: [PATCH 7/9] remove boxdialog/mouseable --- src/ltui/boxdialog.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ltui/boxdialog.lua b/src/ltui/boxdialog.lua index 0e547fd..f27f0ac 100644 --- a/src/ltui/boxdialog.lua +++ b/src/ltui/boxdialog.lua @@ -66,7 +66,6 @@ function boxdialog:init(name, bounds, title) end) -- on click for frame - self:option_set("mouseable", true) self:frame():action_set(action.ac_on_clicked, function (v, x, y) -- get relative coordinates From dac24fad54e2941c8a7b49aa570290b7b50e2142 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Nov 2020 00:37:16 +0800 Subject: [PATCH 8/9] improve panel/on_clicked --- src/ltui/panel.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index 3a478c8..26c38e1 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -65,11 +65,10 @@ function panel:init(name, bounds) local p = v:last() while p do if p:option('selectable') and p:bounds():contains(x, y) then - v:select(p) if p:option("mouseable") then - p:action_on(action.ac_on_clicked, x, y) + v:select(p) + return p:action_on(action.ac_on_clicked, x, y) end - return true end p = v:prev(p) end From 41d7af59403848b1211b22cecdfb4191ab13a3a9 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 Nov 2020 00:38:24 +0800 Subject: [PATCH 9/9] improve panel --- src/ltui/panel.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ltui/panel.lua b/src/ltui/panel.lua index 26c38e1..1632f9e 100644 --- a/src/ltui/panel.lua +++ b/src/ltui/panel.lua @@ -69,6 +69,7 @@ function panel:init(name, bounds) v:select(p) return p:action_on(action.ac_on_clicked, x, y) end + return true end p = v:prev(p) end