diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-29 12:55:02 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-29 12:55:02 +0800 |
commit | 75169afcc32f1fee13bf7b5027bf41bc14aca93b (patch) | |
tree | 226cb127ec2b6d6f38237a044f5b7bb84b281128 /mbbsd | |
parent | ff4f367049df2ad17d4ecd5e63d765c9f361cb8d (diff) | |
download | pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar.gz pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar.bz2 pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar.lz pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar.xz pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.tar.zst pttbbs-75169afcc32f1fee13bf7b5027bf41bc14aca93b.zip |
pmore: dbcs aware search
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2874 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/pmore.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 54eba1bc..74aa4f0f 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -157,6 +157,9 @@ int debug = 0; #endif /* PMORE_STYLE_ANSI */ +#define ANSI_IN_MOVECMD(x) (strchr("ABCDfjHJRu", x) != NULL) +#define PMORE_DBCS_LEADING(c) (c >= 0x80) + // Poor BBS terminal system Workarounds // - Most BBS implements clrtoeol() as fake command // and usually messed up when output ANSI quoted string. @@ -629,8 +632,11 @@ mf_search(int direction) { flFound = 1; break; - } else - mf.disps ++; + } else { + /* go forward. we can do DBCS check here. */ + if(PMORE_DBCS_LEADING(*mf.disps++)) + mf.disps++; + } } mf_backward(0); if(mf.disps > mf.maxdisps) @@ -648,7 +654,11 @@ mf_search(int direction) { flFound = 1; } else - mf.disps ++; + { + /* go forward. we can do DBCS check here. */ + if(PMORE_DBCS_LEADING(*mf.disps++)) + mf.disps++; + } } if(!flFound) mf_backward(1); @@ -719,7 +729,6 @@ pmore_str_chomp(unsigned char *p) memmove(p, pb, strlen(pb)+1); } -#define PMORE_DBCS_LEADING(c) (c >= 0x80) #if 0 int pmore_str_safe_big5len(unsigned char *p) @@ -1167,9 +1176,10 @@ mf_display() break; case MFDISP_RAW_PLAIN: break; + default: #ifdef PMORE_RESTRICT_ANSI_MOVEMENT - if(strchr("ABCDfjHJRu", c) != NULL) + if(ANSI_IN_MOVECMD(c)) c = 's'; // "save cursor pos" #endif outc(c); @@ -2191,7 +2201,15 @@ pmore(char *fpath, int promptend) if(ch == '|') bpref.rawmode += MFDISP_RAW_MODES-1; else + { + /* '\\' */ + + /* should we do first time prompt checking here, + * or remove hotkey '\\'? + static unsigned char first_prompt = 1; + */ bpref.rawmode ++; + } bpref.rawmode %= MFDISP_RAW_MODES; switch(bpref.rawmode) { |