Skip to content
Snippets Groups Projects
Commit 7b3873e5 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix mnemonics bug introduced in commit b84c583a

We want to not expand tilde to attributes when there are any attribute codes
in the mnemonics string. The existene of a non-attribute ctrl-a code should
not have prevented the tilde expansion.

Fix for issue #805 reported by Nelgin (thank you)
parent f84b22c9
No related branches found
No related tags found
No related merge requests found
Pipeline #6968 passed
......@@ -182,7 +182,7 @@ void sbbs_t::mnemonics(const char *instr)
bputs(instr);
return;
}
bool ctrl_a_codes = (strchr(instr, CTRL_A) != NULL) && !contains_invalid_attr(instr);
bool ctrl_a_codes = contains_ctrl_a_attr(instr);
if(!ctrl_a_codes) {
const char* last = lastchar(instr);
if(instr[0] == '@' && *last == '@' && strchr(instr + 1, '@') == last && strchr(instr, ' ') == NULL) {
......
......@@ -535,16 +535,15 @@ size_t strip_invalid_attr(char *str)
}
/****************************************************************************/
/* Detects invalid Ctrl-Ax "attribute" sequences in str */
/* Returns number of ^A's in line */
/* Detects valid Ctrl-Ax "attribute" sequences in str */
/****************************************************************************/
bool contains_invalid_attr(const char *str)
bool contains_ctrl_a_attr(const char *str)
{
while(*str != '\0') {
if(*str == CTRL_A) {
++str;
if(!valid_ctrl_a_attr(*str))
if(valid_ctrl_a_attr(*str))
return true;
}
++str;
......
......@@ -57,7 +57,7 @@ DLLEXPORT char * strip_char(const char* str, char* dest, char);
DLLEXPORT bool valid_ctrl_a_attr(char a);
DLLEXPORT bool valid_ctrl_a_code(char a);
DLLEXPORT size_t strip_invalid_attr(char *str);
DLLEXPORT bool contains_invalid_attr(const char*);
DLLEXPORT bool contains_ctrl_a_attr(const char*);
DLLEXPORT char * u32toac(uint32_t, char*, char sep);
DLLEXPORT char * u64toac(uint64_t, char*, char sep);
DLLEXPORT char * rot13(char* str);
......
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