summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-18 15:50:34 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-18 15:50:34 +0800
commit9896099baf6e727919325820bb6dcd368ca0b705 (patch)
tree0ce0ac66075965405d8a4cb78520f13e05ec7233 /mbbsd
parent37f7b8ce5a7909a47b18bdcdddc66feec0db3839 (diff)
downloadpttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar.gz
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar.bz2
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar.lz
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar.xz
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.tar.zst
pttbbs-9896099baf6e727919325820bb6dcd368ca0b705.zip
- (internal) refine i/o system to try new vget system
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4189 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/io.c71
-rw-r--r--mbbsd/visio.c16
2 files changed, 46 insertions, 41 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index b2ee791d..52d3abb6 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -286,6 +286,10 @@ dogetch(void)
icurrchar ++;
return Ctrl('M');
}
+
+ // XXX also treat ^H and 127 (KEY_BS2) the same one?
+ // if (inbuf[icurrchar] == KEY_BS2)
+ // return Ctrl('H');
return (unsigned char)inbuf[icurrchar++];
}
@@ -392,15 +396,6 @@ igetch(void)
if (ch == '[' || ch == 'O')
{ mode = 2; last = ch; }
-#if 0
- /* some user complained about this since they wanna
- * do Esc-N paste in vedit.
- * Before anyone to explain what this is for,
- * this will be commented.
- */
- else if (ch == '1' || ch == '4') /* what is this!? */
- { mode = 3; last = ch; }
-#endif
else {
KEY_ESC_arg = ch;
return KEY_ESC;
@@ -665,17 +660,6 @@ igetch(void)
}
return ch;
- // try to do this in getch() level.
-#if 0
- case Ctrl('J'): /* Ptt §â \n ®³±¼ */
-#ifdef PLAY_ANGEL
- /* Seams some telnet client still send CR LF when changing lines.
- CallAngel();
- */
-#endif
- continue;
-#endif
-
default:
return ch;
}
@@ -757,6 +741,8 @@ peek_input(float f, int c)
return 0;
}
+#ifndef TRY_VGETS
+
#define MAXLASTCMD 12
static int
getdata_raw(int line, int col, const char *prompt, char *buf, int len, int echo)
@@ -1003,21 +989,34 @@ getdata_raw(int line, int col, const char *prompt, char *buf, int len, int echo)
if(occupy_msg) msg_occupied --;
return clen;
}
+#else // TRY_VGETS
-/* Ptt */
-int
-getdata_buf(int line, int col, const char *prompt, char *buf, int len, int echo)
+static int
+getdata2vgetflag(int echo)
{
-#ifdef TRY_VGETS
- move(line, col);
- if(prompt && *prompt) outs(prompt);
+ assert(echo != GCARRY);
+
if (echo == LCECHO)
echo = VGET_LOWERCASE;
+ else if (echo == NUMECHO)
+ echo = VGET_DIGITS;
else if (echo == NOECHO)
echo = VGET_NOECHO;
else
echo = VGET_DEFAULT;
- return vgetstr(buf, len, echo, buf);
+
+ return echo;
+}
+#endif // TRY_VGETS
+
+/* Ptt */
+int
+getdata_buf(int line, int col, const char *prompt, char *buf, int len, int echo)
+{
+#ifdef TRY_VGETS
+ move(line, col);
+ if(prompt && *prompt) outs(prompt);
+ return vgetstr(buf, len, getdata2vgetflag(echo), buf);
#else
return getdata_raw(line, col, prompt, buf, len, echo);
#endif
@@ -1030,13 +1029,7 @@ getdata_str(int line, int col, const char *prompt, char *buf, int len, int echo,
#ifdef TRY_VGETS
move(line, col);
if(prompt && *prompt) outs(prompt);
- if (echo == LCECHO)
- echo = VGET_LOWERCASE;
- else if (echo == NOECHO)
- echo = VGET_NOECHO;
- else
- echo = VGET_DEFAULT;
- return vgetstr(buf, len, echo, defaultstr);
+ return vgetstr(buf, len, getdata2vgetflag(echo), defaultstr);
#else
// if pointer is the same, ignore copy.
if (defaultstr != buf)
@@ -1051,19 +1044,14 @@ getdata(int line, int col, const char *prompt, char *buf, int len, int echo)
#ifdef TRY_VGETS
move(line, col);
if(prompt && *prompt) outs(prompt);
- if (echo == LCECHO)
- echo = VGET_LOWERCASE;
- else if (echo == NOECHO)
- echo = VGET_NOECHO;
- else
- echo = VGET_DEFAULT;
- return vgets(buf, len, echo);
+ return vgets(buf, len, getdata2vgetflag(echo));
#else
buf[0] = 0;
return getdata_raw(line, col, prompt, buf, len, echo);
#endif
}
+#if 0
int
vget(int line, int col, const char *prompt, char *buf, int len, int mode)
{
@@ -1074,6 +1062,7 @@ vget(int line, int col, const char *prompt, char *buf, int len, int mode)
return getdata_raw(line, col, prompt, buf, len, mode);
}
}
+#endif
/* vim:sw=4
*/
diff --git a/mbbsd/visio.c b/mbbsd/visio.c
index 35384ab8..27b6cbf9 100644
--- a/mbbsd/visio.c
+++ b/mbbsd/visio.c
@@ -853,6 +853,7 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
int line, col;
int icurr = 0, iend = 0, abort = 0;
int c;
+ char ismsgline = 0;
// always use internal buffer to prevent temporary input issue.
char buf[STRLEN] = ""; // zero whole.
@@ -884,6 +885,13 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
getyx(&line, &col); // now (line,col) is the beginning of our new fields.
+ // XXX be compatible with traditional...
+ if (line == b_lines - msg_occupied)
+ ismsgline = 1;
+
+ if (ismsgline)
+ msg_occupied ++;
+
while (!abort)
{
if (!(flags & VGET_NOECHO))
@@ -1084,6 +1092,14 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
// copy buffer!
memcpy(_buf, buf, len);
+
+ // XXX update screen display
+ if (ismsgline)
+ msg_occupied --;
+
+ /* because some code then outs so change new line.*/
+ move(line+1, 0);
+
return iend;
}