diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-12 10:12:58 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-12 10:12:58 +0800 |
commit | 030d6be038cee4365547eb8cde371f402940a49f (patch) | |
tree | e948191f095bff05d7cc1b5597c19b35c6b452f3 | |
parent | 389e5b251f47fbd2c8de372f1a711eea2f969728 (diff) | |
download | pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar.gz pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar.bz2 pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar.lz pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar.xz pttbbs-030d6be038cee4365547eb8cde371f402940a49f.tar.zst pttbbs-030d6be038cee4365547eb8cde371f402940a49f.zip |
- board: change 's' in board to do global search, more like other 's'.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4139 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/board.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index df9fe226..5f344f88 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -991,30 +991,13 @@ load_boards(char *key) } static int -search_board(void) +search_board(const char *bname) { - int num; - char genbuf[IDLEN + 2]; - struct NameList namelist; - - move(0, 0); - clrtoeol(); - NameList_init(&namelist); + int num = 0; assert(brdnum<=nbrdsize); - NameList_resizefor(&namelist, brdnum); - for (num = 0; num < brdnum; num++) - if (!IS_LISTING_FAV() || - (nbrd[num].myattr & NBRD_BOARD && HasBoardPerm(B_BH(&nbrd[num]))) ) - NameList_add(&namelist, B_BH(&nbrd[num])->brdname); - namecomplete2(&namelist, MSG_SELECT_BOARD, genbuf); - NameList_delete(&namelist); - -#ifdef DEBUG - vmsg(genbuf); -#endif for (num = 0; num < brdnum; num++) - if (!strcasecmp(B_BH(&nbrd[num])->brdname, genbuf)) + if (!strcasecmp(B_BH(&nbrd[num])->brdname, bname)) return num; return -1; } @@ -1574,21 +1557,21 @@ choose_board(int newflag) show_brdlist(head, 0, newflag); break; case 's': - if ((tmp = search_board()) != -1) { + { + int cbid = currbid; + // try global search instead. + ReadSelect(); + // restore my mode + setutmpmode(newflag ? READNEW : READBRD); + // force refresh head = -1; - num = tmp; - break; + // try to match cursor if we can. + if (cbid != currbid && currbid && currboard) + { + if ((tmp = search_board(currboard)) != -1) + num = tmp; + } } - // TODO try global search? - // TODO entering boards is now too complex... - // please refine the code. - // - // if (Select() != NEWDIRECT) { - // } - - // update screen - head = -1; - num = tmp; break; case KEY_RIGHT: |