From ba7696ff7174d8d07e6aec4138b9cce5f0952ca4 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 20 Jan 2018 00:45:29 +0800 Subject: add text changed --- xmake/core/ui/inputdialog.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xmake/core/ui/inputdialog.lua') diff --git a/xmake/core/ui/inputdialog.lua b/xmake/core/ui/inputdialog.lua index b91070cb1..dc908bc29 100644 --- a/xmake/core/ui/inputdialog.lua +++ b/xmake/core/ui/inputdialog.lua @@ -48,6 +48,20 @@ function inputdialog:init(name, bounds, title) self:text():bounds().ey = 1 self:text():invalidate(true) self:text():option_set("selectable", false) + self:text():option_set("progress", false) + + -- text changed + self:text():action_set("text.changed", function (v, e) + if e.text then + local lines = #e.text:split('\n', true) + if lines > 0 and lines < self:height() then + self:text():bounds().ey = lines + self:textedit():bounds().sy = lines + self:text():invalidate(true) + self:textedit():invalidate(true) + end + end + end) end -- get textedit -- cgit v1.3.1