1
0
Fork 0
forked from len0rd/rockbox

Text viewer: Fix wrong calculation of bookmark's position (introduced by r25611)

Also change message shown for bookmark operations and add comment


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25614 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2010-04-12 21:15:10 +00:00
parent 4775ad426d
commit 886cd3fb85

View file

@ -1565,7 +1565,7 @@ static void viewer_draw(int col)
/* display on screen the displayed part of the line */ /* display on screen the displayed part of the line */
if (col != -1) if (col != -1)
{ {
bool in_page = (cline+i > display_lines); bool in_page = (cline+i <= display_lines);
int dpage = cpage + (in_page ? 0 : 1); int dpage = cpage + (in_page ? 0 : 1);
int dline = cline + i - (in_page ? 0 : display_lines); int dline = cline + i - (in_page ? 0 : display_lines);
bool bflag = (viewer_find_bookmark(dpage, dline) >= 0); bool bflag = (viewer_find_bookmark(dpage, dline) >= 0);
@ -2595,6 +2595,7 @@ static void calc_page(void)
fill_buffer(file_pos, buffer, buffer_size); fill_buffer(file_pos, buffer, buffer_size);
line_end = line_begin = buffer; line_end = line_begin = buffer;
/* update page and line of all bookmark */
for (i = 0; i < bookmark_count; i++) for (i = 0; i < bookmark_count; i++)
{ {
sfp = bookmarks[i].file_position; sfp = bookmarks[i].file_position;
@ -3249,17 +3250,17 @@ enum plugin_status plugin_start(const void* file)
if (idx < 0) if (idx < 0)
{ {
if (bookmark_count >= MAX_BOOKMARKS-1) if (bookmark_count >= MAX_BOOKMARKS-1)
rb->splash(HZ/2, "No more add bookmark."); rb->splash(HZ/2, "No more bookmarks");
else else
{ {
viewer_add_bookmark(); viewer_add_bookmark();
rb->splash(HZ/2, "Bookmark add."); rb->splash(HZ/2, "Bookmark added");
} }
} }
else else
{ {
viewer_remove_bookmark(idx); viewer_remove_bookmark(idx);
rb->splash(HZ/2, "Bookmark remove."); rb->splash(HZ/2, "Bookmark removed");
} }
viewer_draw(col); viewer_draw(col);
} }