| 61 |
UNSET_FAVOR_ARTICLE, |
UNSET_FAVOR_ARTICLE, |
| 62 |
FIRST_TOPIC_ARTICLE, |
FIRST_TOPIC_ARTICLE, |
| 63 |
LAST_TOPIC_ARTICLE, |
LAST_TOPIC_ARTICLE, |
| 64 |
|
LAST_SECTION_ARTICLE, |
| 65 |
SCAN_NEW_ARTICLE, |
SCAN_NEW_ARTICLE, |
| 66 |
SCAN_ARTICLE_BACKWARD_BY_USER, |
SCAN_ARTICLE_BACKWARD_BY_USER, |
| 67 |
SCAN_ARTICLE_FORWARD_BY_USER, |
SCAN_ARTICLE_FORWARD_BY_USER, |
| 369 |
break; |
break; |
| 370 |
case '$': |
case '$': |
| 371 |
case KEY_END: |
case KEY_END: |
| 372 |
|
if (*p_page_id + 1 == total_page && *p_selected_index + 1 == item_count) // Press END at end of list |
| 373 |
|
{ |
| 374 |
|
return LAST_SECTION_ARTICLE; |
| 375 |
|
} |
| 376 |
if (total_page > 0) |
if (total_page > 0) |
| 377 |
{ |
{ |
| 378 |
*p_page_id = total_page - 1; |
*p_page_id = total_page - 1; |
| 715 |
// Update current aid location |
// Update current aid location |
| 716 |
if (p_articles[selected_index] != NULL) |
if (p_articles[selected_index] != NULL) |
| 717 |
{ |
{ |
| 718 |
section_aid_locations[section_index] = (p_articles[selected_index]->visible ? p_articles[selected_index]->aid : 0); |
if (selected_index >= ontop_start_offset) |
| 719 |
|
{ |
| 720 |
|
ret = last_article_in_section(p_section, &p_article_locate); |
| 721 |
|
if (ret < 0) |
| 722 |
|
{ |
| 723 |
|
log_error("last_article_in_section(sid=%d) error\n", p_section->sid); |
| 724 |
|
return -3; |
| 725 |
|
} |
| 726 |
|
else if (ret == 0) |
| 727 |
|
{ |
| 728 |
|
section_aid_locations[section_index] = 0; |
| 729 |
|
} |
| 730 |
|
else // ret > 0 |
| 731 |
|
{ |
| 732 |
|
section_aid_locations[section_index] = p_article_locate->aid; |
| 733 |
|
} |
| 734 |
|
} |
| 735 |
|
else |
| 736 |
|
{ |
| 737 |
|
section_aid_locations[section_index] = (p_articles[selected_index]->visible ? p_articles[selected_index]->aid : 0); |
| 738 |
|
} |
| 739 |
} |
} |
| 740 |
return 0; |
return 0; |
| 741 |
case CHANGE_PAGE: |
case CHANGE_PAGE: |
| 1101 |
return -3; |
return -3; |
| 1102 |
} |
} |
| 1103 |
else if (ret > 0 && page_id != page_id_cur) // found and page changed |
else if (ret > 0 && page_id != page_id_cur) // found and page changed |
| 1104 |
|
{ |
| 1105 |
|
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 1106 |
|
if (ret < 0) |
| 1107 |
|
{ |
| 1108 |
|
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
| 1109 |
|
return -3; |
| 1110 |
|
} |
| 1111 |
|
} |
| 1112 |
|
break; |
| 1113 |
|
case LAST_SECTION_ARTICLE: |
| 1114 |
|
page_id_cur = page_id; |
| 1115 |
|
ret = last_article_in_section(p_section, &p_article_locate); |
| 1116 |
|
if (ret < 0) |
| 1117 |
|
{ |
| 1118 |
|
log_error("last_article_in_section(sid=%d) error\n", p_section->sid); |
| 1119 |
|
return -3; |
| 1120 |
|
} |
| 1121 |
|
else if (ret == 0) |
| 1122 |
|
{ |
| 1123 |
|
break; |
| 1124 |
|
} |
| 1125 |
|
ret = locate_article_in_section(p_section, p_article_locate, 0, 0, |
| 1126 |
|
&page_id, &selected_index, &article_count); |
| 1127 |
|
if (ret < 0) |
| 1128 |
|
{ |
| 1129 |
|
log_error("locate_article_in_section(sid=%d, aid=%d, direction=0, step=0) error\n", |
| 1130 |
|
p_section->sid, p_article_locate->aid); |
| 1131 |
|
return -3; |
| 1132 |
|
} |
| 1133 |
|
else if (ret > 0 && page_id != page_id_cur) // found and page changed |
| 1134 |
{ |
{ |
| 1135 |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 1136 |
if (ret < 0) |
if (ret < 0) |