Skip to content
Snippets Groups Projects
Commit 284778fd authored by rswindell's avatar rswindell
Browse files

Added support for ^A+ and ^A- to push (save) and pop (restore) attributes.

This will be handy for correctly converting colored HTML text to ANSI.
parent ca1a6bec
No related branches found
No related tags found
No related merge requests found
......@@ -412,9 +412,16 @@ void sbbs_t::ctrl_a(char x)
case ')': /* turn echo back on */
console&=~CON_ECHO_OFF;
break;
case '-': /* turn off all attributes if */
if(atr&(HIGH|BLINK|BG_LIGHTGRAY)) /* high intensity, blink or */
attr(LIGHTGRAY); /* background bits are set */
case '+': /* push current attribte */
if(attr_sp<sizeof(attr_stack))
attr_stack[attr_sp++]=curatr;
break;
case '-': /* pop current attribute OR optimized "normal" */
if(attr_sp>0)
attr(attr_stack[--attr_sp]);
else /* turn off all attributes if */
if(atr&(HIGH|BLINK|BG_LIGHTGRAY)) /* high intensity, blink or */
attr(LIGHTGRAY); /* background bits are set */
break;
case '_': /* turn off all attributes if */
if(atr&(BLINK|BG_LIGHTGRAY)) /* blink or background is set */
......
......@@ -2077,6 +2077,7 @@ sbbs_t::sbbs_t(ushort node_num, DWORD addr, char* name, SOCKET sd,
telnet_last_rxch=0;
sys_status=lncntr=tos=criterrs=keybufbot=keybuftop=lbuflen=slcnt=0L;
curatr=LIGHTGRAY;
attr_sp=0; /* attribute stack pointer */
errorlevel=0;
logcol=1;
logfile_fp=NULL;
......
......@@ -54,6 +54,7 @@ char sbbs_t::putmsg(char HUGE16 *str, long mode)
int orgcon=console,i;
ulong l=0,sys_status_sav=sys_status;
attr_sp=0; /* clear any saved attributes */
tmpatr=curatr; /* was lclatr(-1) */
if(!(mode&P_SAVEATR))
attr(LIGHTGRAY);
......@@ -250,6 +251,7 @@ char sbbs_t::putmsg(char HUGE16 *str, long mode)
if(mode&P_HTML)
putcom("\x02");
attr_sp=0; /* clear any saved attributes */
/* Restore original settings of Forced Pause On/Off */
sys_status&=~(SS_PAUSEOFF|SS_PAUSEON);
sys_status|=(sys_status_sav&(SS_PAUSEOFF|SS_PAUSEON));
......
......@@ -244,6 +244,8 @@ public:
time_t timeout; /* User inactivity timeout reference */
ulong timeleft_warn; /* low timeleft warning flag */
uchar curatr; /* Current Text Attributes Always */
uchar attr_stack[64]; /* Saved attributes (stack) */
int attr_sp; /* Attribute stack pointer */
long lncntr; /* Line Counter - for PAUSE */
long tos; /* Top of Screen */
long rows; /* Current number of Rows for User */
......
......@@ -442,7 +442,8 @@ BOOL DLLCALL validattr(char a)
{
switch(toupper(a)) {
case '-': /* clear */
case '+': /* push attr */
case '-': /* pop attr */
case '_': /* clear */
case 'B': /* blue fg */
case 'C': /* cyan fg */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment