...
 
Commits (1)
  • Rob Swindell's avatar
    Support PETSCII terminals connected to non-PETSCII ports · 0eaa6bbf
    Rob Swindell authored
    The reported problem (by John "Jay" Crutti) was:
    If autodetection of the terminal is used from the defaults menu I get stuck on the prompt to hit my Delete key because on the BBS, it keeps showing me login statistics every time I hit my delete key. 
    
    Add/use new K_CTRLKEYS mode to stop inkey() from handling/eating control-keys (e.g. Ctrl-T) when asking user to hit backspace during defaults->terminal settings.
    
    Allow PETSCII_DELETE (Ctrl-T) as a valid option when asking for the backspace/delete key and set the PETSCII flag in the autoterm variable if hit by the user.
    0eaa6bbf
...@@ -116,7 +116,7 @@ char sbbs_t::inkey(long mode, unsigned long timeout) ...@@ -116,7 +116,7 @@ char sbbs_t::inkey(long mode, unsigned long timeout)
this->timeout=time(NULL); this->timeout=time(NULL);
/* Is this a control key */ /* Is this a control key */
if(ch<' ') { if(!(mode & K_CTRLKEYS) && ch < ' ') {
if(cfg.ctrlkey_passthru&(1<<ch)) /* flagged as passthru? */ if(cfg.ctrlkey_passthru&(1<<ch)) /* flagged as passthru? */
return(ch); /* do not handle here */ return(ch); /* do not handle here */
return(handle_ctrlkey(ch,mode)); return(handle_ctrlkey(ch,mode));
......
...@@ -154,7 +154,7 @@ BOOL sbbs_t::newuser() ...@@ -154,7 +154,7 @@ BOOL sbbs_t::newuser()
while(text[HitYourBackspaceKey][0] && !(useron.misc&(PETSCII|SWAP_DELETE)) && online) { while(text[HitYourBackspaceKey][0] && !(useron.misc&(PETSCII|SWAP_DELETE)) && online) {
bputs(text[HitYourBackspaceKey]); bputs(text[HitYourBackspaceKey]);
uchar key = getkey(K_NONE); uchar key = getkey(K_CTRLKEYS);
bprintf(text[CharacterReceivedFmt], key, key); bprintf(text[CharacterReceivedFmt], key, key);
if(key == '\b') if(key == '\b')
break; break;
......
...@@ -767,6 +767,7 @@ typedef enum { /* Values for xtrn_t.event */ ...@@ -767,6 +767,7 @@ typedef enum { /* Values for xtrn_t.event */
#define K_NOSPIN (1L<<21) /* Do not honor the user's spinning cursor */ #define K_NOSPIN (1L<<21) /* Do not honor the user's spinning cursor */
#define K_ANSI_CPR (1L<<22) /* Expect ANSI Cursor Position Report */ #define K_ANSI_CPR (1L<<22) /* Expect ANSI Cursor Position Report */
#define K_TRIM (1L<<23) /* Trimmed white-space */ #define K_TRIM (1L<<23) /* Trimmed white-space */
#define K_CTRLKEYS (1L<<24) /* No control-key handling/eating in inkey()*/
/* Bits in 'mode' for putmsg and printfile */ /* Bits in 'mode' for putmsg and printfile */
#define P_NONE 0 /* No mode flags */ #define P_NONE 0 /* No mode flags */
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
/*******************************************************************/ /*******************************************************************/
#include "sbbs.h" #include "sbbs.h"
#include "petdefs.h"
#define SEARCH_TXT 0 #define SEARCH_TXT 0
#define SEARCH_ARS 1 #define SEARCH_ARS 1
...@@ -974,9 +975,9 @@ void sbbs_t::maindflts(user_t* user) ...@@ -974,9 +975,9 @@ void sbbs_t::maindflts(user_t* user)
else else
user->misc&=~NO_EXASCII; user->misc&=~NO_EXASCII;
user->misc &= ~SWAP_DELETE; user->misc &= ~SWAP_DELETE;
while(text[HitYourBackspaceKey][0] && !(user->misc&SWAP_DELETE) && online) { while(text[HitYourBackspaceKey][0] && !(user->misc&(PETSCII|SWAP_DELETE)) && online) {
bputs(text[HitYourBackspaceKey]); bputs(text[HitYourBackspaceKey]);
uchar key = getkey(K_NONE); uchar key = getkey(K_CTRLKEYS);
bprintf(text[CharacterReceivedFmt], key, key); bprintf(text[CharacterReceivedFmt], key, key);
if(key == '\b') if(key == '\b')
break; break;
...@@ -984,6 +985,12 @@ void sbbs_t::maindflts(user_t* user) ...@@ -984,6 +985,12 @@ void sbbs_t::maindflts(user_t* user)
if(text[SwapDeleteKeyQ][0] == 0 || yesno(text[SwapDeleteKeyQ])) if(text[SwapDeleteKeyQ][0] == 0 || yesno(text[SwapDeleteKeyQ]))
user->misc |= SWAP_DELETE; user->misc |= SWAP_DELETE;
} }
else if(key == PETSCII_DELETE) {
autoterm |= PETSCII;
user->misc |= PETSCII;
outcom(PETSCII_UPPERLOWER);
bputs(text[PetTerminalDetected]);
}
else else
bprintf(text[InvalidBackspaceKeyFmt], key, key); bprintf(text[InvalidBackspaceKeyFmt], key, key);
} }
......