summaryrefslogtreecommitdiff
path: root/xmake/core/ui/inputdialog.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-20 00:45:29 +0800
committerruki <[email protected]>2018-01-19 22:32:58 +0800
commitba7696ff7174d8d07e6aec4138b9cce5f0952ca4 (patch)
treeef52c41eca271695dad3c802efc8be8c0bdf8b8a /xmake/core/ui/inputdialog.lua
parent35ca390ac845a86c78e34059946207f8f980ed5e (diff)
add text changed
Diffstat (limited to 'xmake/core/ui/inputdialog.lua')
-rw-r--r--xmake/core/ui/inputdialog.lua14
1 files changed, 14 insertions, 0 deletions
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