Merge pull request #22 from laelnasan/mouse-bugfix
mouseable textedit and block mouse on dialogs
This commit is contained in:
@@ -63,6 +63,9 @@ function dialog:init(name, bounds, title)
|
||||
self:buttons():bounds_set(rect:new(0, v:height() - 1, v:width(), 1))
|
||||
self:_update_buttons_layout()
|
||||
end)
|
||||
|
||||
-- mark as block mouse
|
||||
self:option_set("blockmouse", true)
|
||||
end
|
||||
|
||||
-- get buttons
|
||||
|
@@ -58,7 +58,7 @@ function panel:init(name, bounds)
|
||||
|
||||
-- try focused first
|
||||
local current = v:current()
|
||||
if current and current:option("mouseable") and current:bounds():contains(x, y) then
|
||||
if current and current:option("mouseable") and (current:option("blockmouse") or current:bounds():contains(x, y)) then
|
||||
return current:action_on(action.ac_on_clicked, x, y)
|
||||
end
|
||||
|
||||
|
@@ -26,6 +26,7 @@ local event = require("ltui/event")
|
||||
local border = require("ltui/border")
|
||||
local curses = require("ltui/curses")
|
||||
local textarea = require("ltui/textarea")
|
||||
local action = require("ltui/action")
|
||||
|
||||
-- define module
|
||||
local textedit = textedit or textarea()
|
||||
@@ -42,6 +43,10 @@ function textedit:init(name, bounds, text)
|
||||
-- mark as selectable
|
||||
self:option_set("selectable", true)
|
||||
|
||||
-- mark as mouseable
|
||||
self:option_set("mouseable", true)
|
||||
self:action_set(action.ac_on_clicked, function () return true end)
|
||||
|
||||
-- disable progress
|
||||
self:option_set("progress", false)
|
||||
|
||||
|
Reference in New Issue
Block a user