Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KviCString::getToken(): add option to skip empty elements (default off) #2574

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

ctrlaltca
Copy link
Contributor

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 in key1=value1, key2=value3, key3=empty.

This is problematic for font options, that can contain empty fields:

"Courier 10 Pitch,10,5,50,,Regular"
family=Courier 10 Pitch pointSize=10 styleHint=5 weight=50 options=Regular stylename= 

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

@ctrlaltca ctrlaltca merged commit 9babfaf into kvirc:master Nov 30, 2023
3 checks passed
@ctrlaltca ctrlaltca deleted the tokenizer branch November 30, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font selection issue
1 participant