From ae5222b97a070433751a73d07830354f290be0fe Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 2 Sep 2024 23:38:57 +0200 Subject: [PATCH] InputText: Unbreak onTapTextBox on an already in-focus field (#12449) The drive-by fix for the original issue noticed late in #12361 turned out to be a bit heavy-handed ;). Fix #12444 Regression since #12361 --- frontend/ui/widget/inputtext.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/ui/widget/inputtext.lua b/frontend/ui/widget/inputtext.lua index 36b2af497..89e8ce99f 100644 --- a/frontend/ui/widget/inputtext.lua +++ b/frontend/ui/widget/inputtext.lua @@ -142,8 +142,11 @@ local function initTouchEvents() if self.keyboard then self.keyboard:showKeyboard() end - -- Make sure we're flagged as in focus again - self:focus() + -- Make sure we're flagged as in focus again. + -- NOTE: self:focus() does a full free/reinit cycle, which is completely unnecessary to begin with, + -- *and* resets cursor position, which is problematic when tapping on an already in-focus field (#12444). + -- So, just flip our own focused flag, that's the only thing we need ;). + self.focused = true end if self._frame_textwidget.dimen ~= nil -- zh keyboard with candidates shown here has _frame_textwidget.dimen = nil and #self.charlist > 0 then -- do not move cursor within a hint