From 09a32c0dad9f896893f2845ba4f403e1cd0f197e Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Sun, 23 Jan 2022 01:08:19 -0800 Subject: [PATCH] Basic PETSCII output column/line counting in putmsg() When printing a PETSCII Sequence (.seq) file, count the lines/rows and columns similar to how we would if we were using outchar() (but we don't, we use the lower-level outcom() to bypass any translations). This is related to issue #325: PETSCII seq files seem to display just fine, the problem I saw was with the auto-pausing (e.g. before a screen-clear) after displaying them. --- src/sbbs3/putmsg.cpp | 46 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/sbbs3/putmsg.cpp b/src/sbbs3/putmsg.cpp index 01b9b918fa..d4510cd752 100644 --- a/src/sbbs3/putmsg.cpp +++ b/src/sbbs3/putmsg.cpp @@ -383,7 +383,7 @@ char sbbs_t::putmsgfrag(const char* buf, long& mode, long org_cols, JSObject* ob l+=2; } else { - if(str[l]=='\n') { + if(!(mode&P_PETSCII) && str[l]=='\n') { if(exatr) /* clear at newline for extra attr codes */ attr(LIGHTGRAY); if(l==0 || str[l-1]!='\r') /* expand sole LF to CR/LF */ @@ -474,9 +474,49 @@ char sbbs_t::putmsgfrag(const char* buf, long& mode, long org_cols, JSObject* ob } size_t skip = sizeof(char); if(mode&P_PETSCII) { - if(term&PETSCII) + if(term&PETSCII) { outcom(str[l]); - else + switch(str[l]) { + case '\r': // PETSCII "Return" / new-line + column = 0; + case PETSCII_DOWN: + lncntr++; + break; + case PETSCII_CLEAR: + case PETSCII_HOME: + row=0; + column=0; + lncntr=0; + break; + case PETSCII_BLACK: + case PETSCII_WHITE: + case PETSCII_RED: + case PETSCII_GREEN: + case PETSCII_BLUE: + case PETSCII_ORANGE: + case PETSCII_BROWN: + case PETSCII_YELLOW: + case PETSCII_CYAN: + case PETSCII_LIGHTRED: + case PETSCII_DARKGRAY: + case PETSCII_MEDIUMGRAY: + case PETSCII_LIGHTGREEN: + case PETSCII_LIGHTBLUE: + case PETSCII_LIGHTGRAY: + case PETSCII_PURPLE: + case PETSCII_UPPERLOWER: + case PETSCII_UPPERGRFX: + case PETSCII_FLASH_ON: + case PETSCII_FLASH_OFF: + case PETSCII_REVERSE_ON: + case PETSCII_REVERSE_OFF: + // No cursor movement + break; + default: + inc_column(1); + break; + } + } else petscii_to_ansibbs(str[l]); } else if((str[l]&0x80) && (mode&P_UTF8)) { if(term&UTF8) -- GitLab