From 8acda4d6c8d57f1eca216717a23337f1bad30600 Mon Sep 17 00:00:00 2001 From: myk002 Date: Fri, 19 Aug 2022 22:40:53 -0700 Subject: [PATCH 1/4] Interpret '4' & '6' as strings, not movement keys --- library/lua/gui/widgets.lua | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index d1801e764..788e16c4f 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -304,6 +304,26 @@ function EditField:onInput(keys) self:setCursor(self.start_pos + mouse_x) return true end + elseif keys._STRING then + local old = self.text + if keys._STRING == 0 then + -- handle backspace + local del_pos = self.cursor - 1 + if del_pos > 0 then + self:setText(old:sub(1, del_pos-1) .. old:sub(del_pos+1), + del_pos) + end + else + local cv = string.char(keys._STRING) + if not self.on_char or self.on_char(cv, old) then + self:setText(old:sub(1,self.cursor-1)..cv..old:sub(self.cursor), + self.cursor + 1) + end + end + if self.on_change and self.text ~= old then + self.on_change(self.text, old) + end + return true elseif keys.CURSOR_LEFT then self:setCursor(self.cursor - 1) return true @@ -325,26 +345,6 @@ function EditField:onInput(keys) elseif keys.A_CARE_MOVE_E then -- Alt-Right (end) self:setCursor() return true - elseif keys._STRING then - local old = self.text - if keys._STRING == 0 then - -- handle backspace - local del_pos = self.cursor - 1 - if del_pos > 0 then - self:setText(old:sub(1, del_pos-1) .. old:sub(del_pos+1), - del_pos) - end - else - local cv = string.char(keys._STRING) - if not self.on_char or self.on_char(cv, old) then - self:setText(old:sub(1,self.cursor-1)..cv..old:sub(self.cursor), - self.cursor + 1) - end - end - if self.on_change and self.text ~= old then - self.on_change(self.text, old) - end - return true end -- if we're modal, then unconditionally eat all the input From 83b2b46d7b4bc61da76a894716fcfeb65c694c38 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Sat, 20 Aug 2022 07:17:11 +0000 Subject: [PATCH 2/4] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index f4bf697f7..0161b0273 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit f4bf697f75431010f71c60e3db5ac62a311599c4 +Subproject commit 0161b02731a6a8dab4041ae8b214295b285fcfae From ce7bc4cdf48def686e0b92ccc6a24ed8d77b1014 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 24 Aug 2022 19:13:10 -0400 Subject: [PATCH 3/4] Update scripts --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 0161b0273..f97a09e1a 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 0161b02731a6a8dab4041ae8b214295b285fcfae +Subproject commit f97a09e1a67187a2b3ad2ba0923864399addd3d7 From 66924be4ea64415a396b58785472c971eaab8ac5 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 25 Aug 2022 07:23:44 +0000 Subject: [PATCH 4/4] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index f97a09e1a..7d5c8f24b 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit f97a09e1a67187a2b3ad2ba0923864399addd3d7 +Subproject commit 7d5c8f24b634f4197975963d27760c9fa3259e7e