summaryrefslogtreecommitdiffstats
path: root/mbbsd/io.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-09 01:48:59 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-09 01:48:59 +0800
commite414d9a2c1048fcb544bb76532dc17339b0ae0a3 (patch)
tree6fc98896ea109950d89fdb5a4a580d205fc559ff /mbbsd/io.c
parentf9fb6ec425c4067b9e9bd9ef67ae601b418ee932 (diff)
downloadpttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar.gz
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar.bz2
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar.lz
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar.xz
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.tar.zst
pttbbs-e414d9a2c1048fcb544bb76532dc17339b0ae0a3.zip
fix getdata with dbcs_aware bug
--This line, and those beflow, will be ignored-- M mbbsd/io.c git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2811 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/io.c')
-rw-r--r--mbbsd/io.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 3032fc3b..4526620f 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -767,6 +767,10 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
#define MAXLASTCMD 12
static char lastcmd[MAXLASTCMD][80];
+#ifdef DBCSAWARE_GETDATA
+ unsigned int dbcsincomplete = 0;
+#endif
+
strip_ansi(buf, buf, STRIP_ALL);
if (prompt) {
@@ -920,10 +924,27 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
default:
if (isprint2(ch) && clen < len && x + clen < scr_cols) {
#ifdef DBCSAWARE_GETDATA
- /* to prevent single byte input */
- if(ISDBCSAWARE() &&
- clen >= len-1 && ch >= 0x80)
- break;
+ if(ISDBCSAWARE())
+ {
+ /* to prevent single byte input */
+ if(dbcsincomplete)
+ {
+ dbcsincomplete = 0;
+ }
+ else if (ch >= 0x80)
+ {
+ dbcsincomplete = 1;
+ if(clen + 2 > len)
+ {
+ /* we can't print this. ignore and eat key. */
+ igetch();
+ dbcsincomplete = 0;
+ break;
+ }
+ } else {
+ /* nothing, normal key. */
+ }
+ }
#endif
for (i = clen + 1; i > currchar; i--)
buf[i] = buf[i - 1];