diff options
| author | 2022-04-05 23:37:33 +0100 | |
|---|---|---|
| committer | 2022-04-05 23:37:33 +0100 | |
| commit | 72372136c46e1863ba09140f1d79e2e53270b86b (patch) | |
| tree | 05468ef0c90e6caa9eeb4ce9b74fd88f77c901be /src/inspstring.cpp | |
| parent | Release v4.0.0 alpha 9. (diff) | |
| parent | Use consistent xline messages locally (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/inspstring.cpp')
| -rw-r--r-- | src/inspstring.cpp | 16 |
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 |
