mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
Merge pull request #1261 from kylef/kylef/strip-resetfg-bg
Strip background colours when we reset foreground
This commit is contained in:
+1
-1
@@ -1413,7 +1413,7 @@ CString CString::StripControls_n() const {
|
||||
digits++;
|
||||
continue;
|
||||
}
|
||||
if (ch == ',' && !comma && digits > 0) {
|
||||
if (ch == ',' && !comma) {
|
||||
comma = true;
|
||||
digits = 0;
|
||||
continue;
|
||||
|
||||
@@ -263,3 +263,29 @@ TEST(StringTest, Contains) {
|
||||
EXPECT_FALSE(
|
||||
CString("Hello, I'm Bob").Contains("i'm bob", CString::CaseSensitive));
|
||||
}
|
||||
|
||||
TEST(StringTest, StripControls) {
|
||||
// Strips reset colours
|
||||
EXPECT_EQ(CString("\x03test").StripControls(), "test");
|
||||
|
||||
// Strips reset foreground and set new background colour
|
||||
EXPECT_EQ(CString("\x03,03test").StripControls(), "test");
|
||||
|
||||
// Strips foreground and background colour
|
||||
EXPECT_EQ(CString("\x03\x30,03test").StripControls(), "test");
|
||||
|
||||
// Strips reset
|
||||
EXPECT_EQ(CString("\x0Ftest").StripControls(), "test");
|
||||
|
||||
// Strips reverse
|
||||
EXPECT_EQ(CString("\x12test").StripControls(), "test");
|
||||
|
||||
// Strips bold
|
||||
EXPECT_EQ(CString("\x02test").StripControls(), "test");
|
||||
|
||||
// Strips italics
|
||||
EXPECT_EQ(CString("\x16test").StripControls(), "test");
|
||||
|
||||
// Strips underline
|
||||
EXPECT_EQ(CString("\x1Ftest").StripControls(), "test");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user