aboutsummaryrefslogtreecommitdiffstats
path: root/src/inspstring.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-04-05 23:37:33 +0100
committerGravatar Sadie Powell2022-04-05 23:37:33 +0100
commit72372136c46e1863ba09140f1d79e2e53270b86b (patch)
tree05468ef0c90e6caa9eeb4ce9b74fd88f77c901be /src/inspstring.cpp
parentRelease v4.0.0 alpha 9. (diff)
parentUse consistent xline messages locally (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/inspstring.cpp')
-rw-r--r--src/inspstring.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/inspstring.cpp b/src/inspstring.cpp
index 19fea55b3..494b41119 100644
--- a/src/inspstring.cpp
+++ b/src/inspstring.cpp
@@ -286,9 +286,19 @@ void TokenList::Remove(const std::string& token)
std::string TokenList::ToString() const
{
- std::string buffer(permissive ? "* " : "-* ");
- buffer.append(stdalgo::string::join(tokens));
- return buffer;
+ if (permissive)
+ {
+ // If the token list is in permissive mode then the tokens are a list
+ // of disallowed tokens.
+ std::string buffer("*");
+ for (const auto& token : tokens)
+ buffer.append(" -").append(token);
+ return buffer;
+ }
+
+ // If the token list is not in permissive mode then the token list is just
+ // a list of allowed tokens.
+ return stdalgo::string::join(tokens);
}
bool TokenList::operator==(const TokenList& other) const