Skip to content
Snippets Groups Projects
Commit 46fe1b33 authored by rswindell's avatar rswindell
Browse files

Created sbbs_t::insert_indicator() to display or remove insert/overwrite

indicator.
Created CON_DELETELINE status to indicate getstr() returned due to line
deletion (versus backspace).
parent 046df1ca
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,9 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
uchar ch;
uchar atr;
console&=~(CON_UPARROW|CON_DOWNARROW|CON_LEFTARROW|CON_BACKSPACE);
console&=~(CON_UPARROW|CON_DOWNARROW|CON_LEFTARROW|CON_BACKSPACE|CON_DELETELINE);
if(!(mode&K_WRAP))
console&=~CON_INSERT;
sys_status&=~SS_ABORT;
if(mode&K_LINE && useron.misc&ANSI && !(mode&K_NOECHO)) {
attr(cfg.color[clr_inputline]);
......@@ -117,9 +119,12 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
}
}
if(console&CON_INSERT && useron.misc&ANSI && !(mode&K_NOECHO))
insert_indicator();
while(!(sys_status&SS_ABORT) && online && input_thread_running) {
if(mode&K_LEFTEXIT
&& console&(CON_UPARROW|CON_LEFTARROW|CON_BACKSPACE))
&& console&(CON_UPARROW|CON_LEFTARROW|CON_BACKSPACE|CON_DELETELINE))
break;
if((ch=getkey(mode|K_GETSTR))==CR)
break;
......@@ -344,16 +349,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
if(!(useron.misc&ANSI) || mode&K_NOECHO)
break;
console^=CON_INSERT;
ANSI_SAVE();
GOTOXY(80,1);
z=curatr; /* and go to EOL */
attr(BLINK|HIGH|LIGHTGRAY);
if(console&CON_INSERT)
outchar('');
else
outchar(' ');
attr(z);
ANSI_RESTORE();
insert_indicator();
break;
case CTRL_W: /* Ctrl-W Delete word left */
if(i<l) {
......@@ -419,7 +415,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
}
}
i=0;
console|=CON_BACKSPACE;
console|=CON_DELETELINE;
break;
case CTRL_Z: /* Undo */
SAFECOPY(str1,undo);
......@@ -635,3 +631,19 @@ long sbbs_t::getnum(ulong max)
}
return(0);
}
void sbbs_t::insert_indicator(void)
{
ANSI_SAVE();
GOTOXY(80,1);
uchar z=curatr; /* and go to EOL */
if(console&CON_INSERT) {
attr(BLINK|BLACK|(LIGHTGRAY<<4));
outchar('I');
} else {
attr(LIGHTGRAY);
outchar(' ');
}
attr(z);
ANSI_RESTORE();
}
\ No newline at end of file
......@@ -475,6 +475,7 @@ public:
size_t getstr_offset;
size_t getstr(char *str, size_t length, long mode);
long getnum(ulong max);
void insert_indicator(void);
/* getkey.cpp */
char getkey(long mode); /* Waits for a key hit local or remote */
......
......@@ -464,6 +464,7 @@ typedef enum { /* Values for xtrn_t.event */
#define CON_BACKSPACE (1<<14) /* Backspace hit, exiting from getstr() */
#define CON_LEFTARROW (1<<15) /* Left arrow hit, exiting from getstr() */
#define CON_INSERT (1<<16) /* Insert mode, for getstr() */
#define CON_DELETELINE (1<<17) /* Deleted line, exiting from getstr() */
/* Number of milliseconds */
#define DELAY_HANGUP 250 /* Delay before modem drops carrier */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment