summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/proto.h3
-rw-r--r--pttbbs/mbbsd/io.c10
-rw-r--r--pttbbs/mbbsd/pfterm.c8
-rw-r--r--pttbbs/mbbsd/screen.c2
4 files changed, 14 insertions, 9 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 3cf1849d..2a691660 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -294,7 +294,8 @@ void vkey_purge(); // identical to drop_input
int vkey_is_full(); // identical to input_isfull
int vkey_detach(void); // works like to add_io(0, 0)
int vkey_attach(int fd); // works like add_io(fd, ...)
-int vkey_is_ready(); // works like (num_in_buf() > 0)
+int vkey_is_ready(); // works like (num_in_buf() > 0)
+int vkey_is_typeahead(void); // quick check if input buffer has data arrived (maybe not ready yet)
/* kaede */
diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c
index b2ae0975..8b0df55f 100644
--- a/pttbbs/mbbsd/io.c
+++ b/pttbbs/mbbsd/io.c
@@ -27,8 +27,7 @@ static unsigned char real_inbuf [IBUFSIZE + CVTGAP*2] = " ";
#define outbuf (real_outbuf+CVTGAP)
static int obufsize = 0;
-static int ibufsize = 0;
-static int icurrchar = 0;
+static int ibufsize = 0, icurrchar = 0;
#ifdef DBG_OUTRPT
// output counter
@@ -198,7 +197,6 @@ ochar(int c)
/* pager processor */
/* ----------------------------------------------------- */
-static int i_newfd; // forward declaration
int
process_pager_keys(int ch)
{
@@ -402,6 +400,12 @@ vkey_is_ready(void)
}
inline int
+vkey_is_typeahead()
+{
+ return num_in_buf() > 0;
+}
+
+inline int
vkey_is_full(void)
{
return ibufsize >= IBUFSIZE;
diff --git a/pttbbs/mbbsd/pfterm.c b/pttbbs/mbbsd/pfterm.c
index 2516ca68..d7367481 100644
--- a/pttbbs/mbbsd/pfterm.c
+++ b/pttbbs/mbbsd/pfterm.c
@@ -412,7 +412,7 @@ void grayout (int y, int end, int level);
//// flat-term internal processor
-int fterm_inbuf (void); // raw input adapter
+int fterm_typeahead (void); // raw input adapter
void fterm_rawc (int c); // raw output adapter
void fterm_rawnewline(void); // raw output adapter
void fterm_rawflush (void); // raw output adapter
@@ -789,7 +789,7 @@ void
refresh(void)
{
// prevent passive update
- if(fterm_inbuf() && ft.typeahead)
+ if(ft.typeahead && fterm_typeahead())
return;
doupdate();
}
@@ -2370,12 +2370,12 @@ region_scroll_up(int top, int bottom)
//////////////////////////////////////////////////////////////////////////
int
-fterm_inbuf(void)
+fterm_typeahead(void)
{
#ifdef _PFTERM_TEST_MAIN
return 0;
#else
- return num_in_buf();
+ return vkey_is_typeahead();
#endif
}
diff --git a/pttbbs/mbbsd/screen.c b/pttbbs/mbbsd/screen.c
index 3ad79bb8..5da0faec 100644
--- a/pttbbs/mbbsd/screen.c
+++ b/pttbbs/mbbsd/screen.c
@@ -296,7 +296,7 @@ typeahead(int fd)
void
refresh(void)
{
- if (num_in_buf() && _typeahead)
+ if (_typeahead && vkey_is_typeahead())
return;
doupdate();
}