mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
fix page comparing in addJump
This commit is contained in:
2
cre.cpp
2
cre.cpp
@@ -99,7 +99,7 @@ static int getNumberOfPages(lua_State *L) {
|
||||
static int getCurrentPage(lua_State *L) {
|
||||
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
|
||||
|
||||
lua_pushinteger(L, doc->text_view->getCurPage());
|
||||
lua_pushinteger(L, doc->text_view->getCurPage()+1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ function CREReader:goto(pos, is_ignore_jump, pos_type)
|
||||
self.doc:gotoPos(pos)
|
||||
end
|
||||
|
||||
-- add to jump_stack, distinguish jump from normal page turn
|
||||
-- add to jump history, distinguish jump from normal page turn
|
||||
-- NOTE:
|
||||
-- even though we have called gotoPos() or gotoXPointer() previously,
|
||||
-- self.pos hasn't been updated yet here, so we can still make use of it.
|
||||
@@ -168,7 +168,7 @@ function CREReader:prevView()
|
||||
end
|
||||
|
||||
----------------------------------------------------
|
||||
-- jump stack related methods
|
||||
-- jump history related methods
|
||||
----------------------------------------------------
|
||||
function CREReader:isSamePage(p1, p2)
|
||||
return self.doc:getPageFromXPointer(p1) == self.doc:getPageFromXPointer(p2)
|
||||
|
||||
@@ -1362,7 +1362,7 @@ function UniReader:addJump(pageno)
|
||||
-- set up new head
|
||||
-- if backward stack top is the same as page to record, remove it
|
||||
if #self.jump_history ~= 0 and
|
||||
self.jump_history[#self.jump_history].page == pageno then
|
||||
self:isSamePage(self.jump_history[#self.jump_history].page, pageno) then
|
||||
self.jump_history[#self.jump_history] = nil
|
||||
end
|
||||
table.insert(self.jump_history, jump_item)
|
||||
|
||||
Reference in New Issue
Block a user