diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cmsys.h | 8 | ||||
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/modes.h | 7 | ||||
-rw-r--r-- | include/proto.h | 13 | ||||
-rw-r--r-- | include/visio.h | 20 |
5 files changed, 37 insertions, 13 deletions
diff --git a/include/cmsys.h b/include/cmsys.h index 0401da26..879b75e9 100644 --- a/include/cmsys.h +++ b/include/cmsys.h @@ -20,10 +20,17 @@ enum STRIP_FLAG { ONLY_COLOR, // allow only colors (ESC [ .. m) NO_RELOAD // allow all known (color+move) }; + enum LOG_FLAG { LOG_CREAT = 1, }; +/* DBCS aware modes */ +enum _DBCS_STATUS { + DBCS_ASCII, + DBCS_LEADING, + DBCS_TRAILING, +}; #ifdef TIMET64 typedef int32_t time4_t; @@ -85,6 +92,7 @@ extern int strip_blank(char *cbuf, char *buf); extern int strip_ansi(char *buf, const char *str, enum STRIP_FLAG flag); extern void strip_nonebig5(unsigned char *str, int maxlen); extern int DBCS_RemoveIntrEscape(unsigned char *buf, int *len); +extern int DBCS_Status(const char *dbcstr, int pos); extern int invalid_pname(const char *str); extern int is_number(const char *p); extern char * qp_encode (char *s, size_t slen, const char *d, const char *tocode); diff --git a/include/common.h b/include/common.h index 2aabc0ff..cf390eee 100644 --- a/include/common.h +++ b/include/common.h @@ -136,6 +136,8 @@ /* 鍵盤設定 */ #define KEY_TAB 9 #define KEY_ESC 27 +#define KEY_BS (Ctrl('H')) +#define KEY_BS2 (0x7f) #define KEY_UP 0x0101 #define KEY_DOWN 0x0102 #define KEY_RIGHT 0x0103 diff --git a/include/modes.h b/include/modes.h index 178add62..7ceb7ba9 100644 --- a/include/modes.h +++ b/include/modes.h @@ -168,13 +168,6 @@ #define AUTHOR_NEXT (RS_AUTHOR | RS_FORWARD) #define AUTHOR_PREV (RS_AUTHOR) -/* DBCS aware modes */ -enum _DBCS_STATUS { - DBCS_ASCII, - DBCS_LEADING, - DBCS_TRAILING, -}; - #define SIG_PK 0 #define SIG_TALK 1 #define SIG_BROADCAST 2 diff --git a/include/proto.h b/include/proto.h index 0b2cebde..674fea53 100644 --- a/include/proto.h +++ b/include/proto.h @@ -577,12 +577,16 @@ int inansistr(char *str, int n); void move_ansi(int y, int x); void getyx_ansi(int *py, int *px); void region_scroll_up(int top, int bottom); + +#ifndef USE_PFTERM +# define SOLVE_ANSI_CACHE() {} +#else // !USE_PFTERM +# define SOLVE_ANSI_CACHE() { outs(" \b"); } +#endif // !USE_PFTERM + #define HAVE_GRAYOUT void grayout(int start, int end, int level); -void save_cursor(void); -void restore_cursor(void); - /* AIDS */ typedef uint64_t aidu_t; aidu_t fn2aidu(char *fn); @@ -706,9 +710,8 @@ int u_cloak(void); int u_list(void); #ifdef DBCSAWARE int u_detectDBCSAwareEvilClient(); -int getDBCSstatus(unsigned char *s, int pos); -#define ISDBCSAWARE() (cuser.uflag & DBCSAWARE_FLAG) #endif +#define ISDBCSAWARE() (cuser.uflag & DBCSAWARE_FLAG) /* vote */ void b_suckinfile(FILE *fp, char *fname); diff --git a/include/visio.h b/include/visio.h index b3164709..06b78907 100644 --- a/include/visio.h +++ b/include/visio.h @@ -24,6 +24,8 @@ #define VCLR_PAUSE_PAD ANSI_COLOR(1;34;44) #define VCLR_PAUSE ANSI_COLOR(1;37;44) +#define VCLR_INPUT_FIELD ANSI_COLOR(0;7) + #define VMSG_PAUSE " 請按任意鍵繼續 " #define VMSG_PAUSE_PAD "▄" #define VMSG_MSG_FLOAT " [按任意鍵繼續]" @@ -42,6 +44,13 @@ #define VFILL_HAS_BORDER VFILL_DEFAULT #define VFILL_NO_BORDER (0x08) +#define VGET_DEFAULT (0x00) +#define VGET_DOECHO (VGET_DEFAULT) +#define VGET_NOECHO (0x01) +#define VGET_LOWERCASE (0x02) +#define VGET_DIGITS (0x04) +#define VGET_GCARRY (0x08) + // DATATYPE DEFINITION ------------------------------------------------- typedef void * VREFSCR; typedef long VREFCUR; @@ -66,11 +75,16 @@ typedef struct { void prints(const char *fmt, ...) GCC_CHECK_FORMAT(1,2); void mvouts(int y, int x, const char *str); +// input history +int InputHistoryAdd (const char *s); +void InputHistoryPrev(char *s, int sz); +void InputHistoryNext(char *s, int sz); + // v*: primitive rendering void vpad (int n, const char *pattern); /// pad n fields by pattern int vgety (void); /// return cursor position (y) void vfill (int n, int flags, const char *s); /// fill n-width space with s -void vfillf (int n, int flags, const char *s, ...) GCC_CHECK_FORMAT(3,4); // formatted version of vfill +void vfillf (int n, int flags, const char *s, ...) GCC_CHECK_FORMAT(3,4); /// formatted version of vfill void vbarlr (const char *l, const char *r); /// draw a left-right expanded bar with (l,r) void vbarf (const char *s, ...) GCC_CHECK_FORMAT(1,2); /// vbarlr with formatted input (\t splits (l,r) void vshowmsg(const char *msg); /// draw standard pause/message @@ -82,6 +96,10 @@ void vshowmsg(const char *msg); /// draw standard pause/message int vans (const char *msg); /// prompt and return (lowercase) single byte input int vansf (const char *fmt,...) GCC_CHECK_FORMAT(1,2); /// formatted input of vans +// vget: (y, x, ...) +int vgets (char *buf, int len, int flags); /// input with edit box control +int vgetstr (char *buf, int len, int flags, const char *str);/// input with default value +int vget(int y, int x, const char *prompt, char *buf, int len, int mode); // vs_*: formatted and themed virtual screen layout // you cannot use ANSI escapes in these APIs. |