mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
fix: remove page number checking in displaying TOC
Former showTOC() method checks the page number in each entry and only display entry whose page number is greater than the previous one. However, I think this is too "clever", we should better leave the TOC untouched to keep consistent with other pdf readers.
This commit is contained in:
5
pdf.c
5
pdf.c
@@ -101,16 +101,17 @@ static int walkTableOfContent(lua_State *L, fz_outline* ol, int *count, int dept
|
||||
lua_pushstring(L, "page");
|
||||
lua_pushnumber(L, ol->dest.ld.gotor.page + 1);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "depth");
|
||||
lua_pushnumber(L, depth);
|
||||
lua_settable(L, -3);
|
||||
lua_pushstring(L, "title");
|
||||
|
||||
lua_pushstring(L, "title");
|
||||
lua_pushstring(L, ol->title);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_settable(L, -3);
|
||||
(*count)++;
|
||||
if (ol->down) {
|
||||
walkTableOfContent(L, ol->down, count, depth);
|
||||
|
||||
@@ -678,15 +678,11 @@ function UniReader:showTOC()
|
||||
end
|
||||
local menu_items = {}
|
||||
local filtered_toc = {}
|
||||
local curr_page = -1
|
||||
-- build menu items
|
||||
for _k,_v in ipairs(self.toc) do
|
||||
if(_v.page >= curr_page) then
|
||||
table.insert(menu_items,
|
||||
(" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title))
|
||||
table.insert(filtered_toc,_v.page)
|
||||
curr_page = _v.page
|
||||
end
|
||||
table.insert(menu_items,
|
||||
(" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title))
|
||||
table.insert(filtered_toc,_v.page)
|
||||
end
|
||||
toc_menu = SelectMenu:new{
|
||||
menu_title = "Table of Contents",
|
||||
|
||||
Reference in New Issue
Block a user