KviCString::getToken(): add option to skip empty elements (default off) #2574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
KviCString::getToken() is used to read option values for font and colors, that are comma separated.
The current behavior of KviCString::getToken() is to skip empty elements if a string contains multiple separators, eg.
value1,,value3
would end up inkey1=value1, key2=value3, key3=empty
.This is problematic for font options, that can contain empty fields:
As you can see "Regular" ended up in the options instead of stylename.
As a result, the font will be underlined (since Regular contains "u")
This PR adds a parameter skipEmpty, default false, to fix this problem.
There's only one more place in the code using this method, in KviIrcServerParser::parseNumericWhoReply(), where is safer to keep the old behavior (skip any space between the 2 parameters)
Fixes a bug introduced in #2568
re-Fix #2567