mirror of
https://github.com/koreader/koreader.git
synced 2025-12-24 12:14:05 +01:00
Inputtext: don't allow the cursor to move within a hint (#7687)
Same as 17e6049e but for "hold".
This commit is contained in:
@@ -120,12 +120,13 @@ if Device:isTouchDevice() or Device:hasDPad() then
|
||||
if self.parent.onSwitchFocus then
|
||||
self.parent:onSwitchFocus(self)
|
||||
end
|
||||
if #self.charlist == 0 then return end -- Avoid cursor moving within a hint.
|
||||
local textwidget_offset = self.margin + self.bordersize + self.padding
|
||||
local x = ges.pos.x - self._frame_textwidget.dimen.x - textwidget_offset
|
||||
local y = ges.pos.y - self._frame_textwidget.dimen.y - textwidget_offset
|
||||
self.text_widget:moveCursorToXY(x, y, true) -- restrict_to_view=true
|
||||
self.charpos, self.top_line_num = self.text_widget:getCharPos()
|
||||
if #self.charlist > 0 then -- Avoid cursor moving within a hint.
|
||||
local textwidget_offset = self.margin + self.bordersize + self.padding
|
||||
local x = ges.pos.x - self._frame_textwidget.dimen.x - textwidget_offset
|
||||
local y = ges.pos.y - self._frame_textwidget.dimen.y - textwidget_offset
|
||||
self.text_widget:moveCursorToXY(x, y, true) -- restrict_to_view=true
|
||||
self.charpos, self.top_line_num = self.text_widget:getCharPos()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -133,11 +134,13 @@ if Device:isTouchDevice() or Device:hasDPad() then
|
||||
if self.parent.onSwitchFocus then
|
||||
self.parent:onSwitchFocus(self)
|
||||
end
|
||||
local textwidget_offset = self.margin + self.bordersize + self.padding
|
||||
local x = ges.pos.x - self._frame_textwidget.dimen.x - textwidget_offset
|
||||
local y = ges.pos.y - self._frame_textwidget.dimen.y - textwidget_offset
|
||||
self.text_widget:moveCursorToXY(x, y, true) -- restrict_to_view=true
|
||||
self.charpos, self.top_line_num = self.text_widget:getCharPos()
|
||||
if #self.charlist > 0 then -- Avoid cursor moving within a hint.
|
||||
local textwidget_offset = self.margin + self.bordersize + self.padding
|
||||
local x = ges.pos.x - self._frame_textwidget.dimen.x - textwidget_offset
|
||||
local y = ges.pos.y - self._frame_textwidget.dimen.y - textwidget_offset
|
||||
self.text_widget:moveCursorToXY(x, y, true) -- restrict_to_view=true
|
||||
self.charpos, self.top_line_num = self.text_widget:getCharPos()
|
||||
end
|
||||
if Device:hasClipboard() and Device.input.hasClipboardText() then
|
||||
self:addChars(Device.input.getClipboardText())
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user