Do also color quoted text.
This commit is contained in:
@@ -100,6 +100,10 @@ static void ReplaceQuotes (StrBuf* Msg)
|
|||||||
static const char QuoteStart[] = "\xE2\x80\x98";
|
static const char QuoteStart[] = "\xE2\x80\x98";
|
||||||
static const char QuoteEnd[] = "\xE2\x80\x99";
|
static const char QuoteEnd[] = "\xE2\x80\x99";
|
||||||
|
|
||||||
|
/* ANSI color sequences */
|
||||||
|
const char* ColorStart = CP_BrightGreen ();
|
||||||
|
const char* ColorEnd = CP_White ();
|
||||||
|
|
||||||
/* Remember a few things */
|
/* Remember a few things */
|
||||||
int IsUTF8 = CP_IsUTF8 ();
|
int IsUTF8 = CP_IsUTF8 ();
|
||||||
|
|
||||||
@@ -113,18 +117,29 @@ static void ReplaceQuotes (StrBuf* Msg)
|
|||||||
char C = SB_Get (Msg);
|
char C = SB_Get (Msg);
|
||||||
switch (C) {
|
switch (C) {
|
||||||
case '`':
|
case '`':
|
||||||
if (!InQuote && IsUTF8) {
|
if (!InQuote) {
|
||||||
SB_AppendStr (&T, QuoteStart);
|
|
||||||
InQuote = 1;
|
InQuote = 1;
|
||||||
|
if (IsUTF8) {
|
||||||
|
SB_AppendStr (&T, QuoteStart);
|
||||||
|
} else {
|
||||||
|
/* ca65 uses \' for opening and closing quotes */
|
||||||
|
SB_AppendChar (&T, '\'');
|
||||||
|
}
|
||||||
|
SB_AppendStr (&T, ColorStart);
|
||||||
} else {
|
} else {
|
||||||
/* ca65 uses \' for opening and closing quotes */
|
/* Found two ` without closing quote - don't replace */
|
||||||
SB_AppendChar (&T, '\'');
|
SB_AppendChar (&T, '`');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
if (InQuote && IsUTF8) {
|
if (InQuote) {
|
||||||
SB_AppendStr (&T, QuoteEnd);
|
|
||||||
InQuote = 0;
|
InQuote = 0;
|
||||||
|
SB_AppendStr (&T, ColorEnd);
|
||||||
|
if (IsUTF8) {
|
||||||
|
SB_AppendStr (&T, QuoteEnd);
|
||||||
|
} else {
|
||||||
|
SB_AppendChar (&T, C);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SB_AppendChar (&T, C);
|
SB_AppendChar (&T, C);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user