mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
TextViewer: add Find (#9507)
This commit is contained in:
@@ -144,6 +144,15 @@ function ScrollTextWidget:getCharPos()
|
||||
return self.text_widget:getCharPos()
|
||||
end
|
||||
|
||||
function ScrollTextWidget:getCharPosAtXY(x, y)
|
||||
return self.text_widget:getCharPosAtXY(x, y)
|
||||
end
|
||||
|
||||
function ScrollTextWidget:getCharPosLineNum(charpos)
|
||||
local _, _, line_num = self.text_widget:_getXYForCharPos(charpos)
|
||||
return line_num -- screen line number
|
||||
end
|
||||
|
||||
function ScrollTextWidget:updateScrollBar(is_partial)
|
||||
local low, high = self.text_widget:getVisibleHeightRatios()
|
||||
if low ~= self.prev_low or high ~= self.prev_high then
|
||||
@@ -187,8 +196,12 @@ function ScrollTextWidget:resetScroll()
|
||||
self.v_scroll_bar.enable = visible_line_count < total_line_count
|
||||
end
|
||||
|
||||
function ScrollTextWidget:moveCursorToCharPos(charpos)
|
||||
self.text_widget:moveCursorToCharPos(charpos)
|
||||
function ScrollTextWidget:moveCursorToCharPos(charpos, centered_lines_count)
|
||||
if centered_lines_count then
|
||||
self.text_widget:moveCursorToCharPosKeepingViewCentered(charpos, centered_lines_count)
|
||||
else
|
||||
self.text_widget:moveCursorToCharPos(charpos)
|
||||
end
|
||||
self:updateScrollBar()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user