From e550588f5f3a3628bae4aed354e0819e0daaf03e Mon Sep 17 00:00:00 2001 From: ptt Date: Thu, 15 Apr 2004 00:28:54 +0000 Subject: push bottom bug fixed git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1762 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/read.c | 86 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 41 deletions(-) (limited to 'mbbsd/read.c') diff --git a/mbbsd/read.c b/mbbsd/read.c index 699d8cec..e8a39da9 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -589,23 +589,20 @@ select_read(keeploc_t * locmem, int sr_mode) } static int -i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid, char* direct, int bottom_line) +i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid, int bottom_line) { int mode = DONOTHING; - + int num; + char direct[60]; switch (ch) { case 'q': case 'e': case KEY_LEFT: if(currmode & MODE_SELECT){ char genbuf[256]; - int num; - fileheader_t *fhdr = &headers[locmem->crs_ln - locmem->top_ln]; - board_select(); setbdir(genbuf, currboard); - locmem = getkeep(genbuf, 0, 1); locmem->crs_ln = getindex(genbuf, fhdr->filename, sizeof(fileheader_t)); num = locmem->crs_ln - p_lines + 1; @@ -787,15 +784,47 @@ i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid, char* direc if (ch > 0 && ch <= onekey_size) { int (*func)() = rcmdlist[ch - 1]; if (func != NULL) - mode = (*func)(locmem->crs_ln>bottom_line? - locmem->crs_ln - bottom_line : locmem->crs_ln, - &headers[locmem->crs_ln - locmem->top_ln], direct); + { + num = locmem->crs_ln - bottom_line; + if (num>0) + { + sprintf(direct,"%s.bottom", currdirect); + mode = (*func)(num, &headers[locmem->crs_ln-locmem->top_ln], + direct); + } + else + mode = (*func)(locmem->crs_ln, + &headers[locmem->crs_ln - locmem->top_ln], currdirect); + } break; } } return mode; } +int +get_records_and_bottom(char *direct, fileheader_t* headers, + int recbase, int p_lines, int last_line, int bottom_line) +{ + int n = bottom_line - recbase + 1, rv; + char directbottom[60]; + + if(n>=p_lines || (currmode & (MODE_SELECT | MODE_DIGEST))) + return get_records(direct, headers, sizeof(fileheader_t), recbase, + p_lines); + + sprintf(directbottom, "%s.bottom", direct); + if (n<=0) + return get_records(directbottom, headers, sizeof(fileheader_t), 1-n, + last_line-recbase); + + rv = get_records(direct, headers, sizeof(fileheader_t), recbase, n); + + if(bottom_linetop_ln = recbase; } - if(recbase <= bottom_line) - entries = get_records(currdirect, headers, FHSZ, recbase, - p_lines); - if( !(currmode & (MODE_SELECT | MODE_DIGEST)) && - entries>=0 && entriescrs_ln > last_line) locmem->crs_ln = last_line; @@ -959,14 +981,8 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey mode = cursor_pos(locmem, i + 1, 10); } else { if (!jump) - { - if(locmem->crs_ln>bottom_line) mode = i_read_key(rcmdlist, locmem, ch, currbid, - directbottom, bottom_line); - else - mode = i_read_key(rcmdlist, locmem, ch, currbid, - currdirect, bottom_line); - } + bottom_line); while (mode == READ_NEXT || mode == READ_PREV || mode == RELATE_FIRST || mode == RELATE_NEXT || mode == RELATE_PREV || mode == THREAD_NEXT || @@ -990,26 +1006,14 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey } else if (reload) { recbase = locmem->top_ln; - if(recbase <= bottom_line) - entries = get_records(currdirect, headers, FHSZ, recbase, - p_lines); - if( !(currmode & (MODE_SELECT | MODE_DIGEST)) && - entries>=0 && entriescrs_ln - locmem->top_ln; if (headers[num].owner[0] != '-') - { - if(locmem->crs_ln>bottom_line) mode = i_read_key(rcmdlist, locmem, ch, currbid, - directbottom, bottom_line); - else - mode = i_read_key(rcmdlist, locmem, ch, bidcache, - currdirect, bottom_line); - } + bottom_line); } } } while (mode != DOQUIT); -- cgit v1.2.3