Preserve spaces in mapping preview of control names

PR https://github.com/dolphin-emu/dolphin/pull/9700 removed spaces from within control names, which some user complained about, and their point of view is kind of understandable:
https://bugs.dolphin-emu.org/issues/12605
with this change, only spaces outside (between) control names are trimmed, which are the ones we wanted to trim in the first place.
This will still retain the major advantages from 9700.

Basically, "`Button 1`   +  `Button 2`" was showing as "`Button1`+`Button2`", while it will now show as "`Button 1`+`Button 2`".
This commit is contained in:
Filippo Tarpini 2021-08-03 00:04:22 +03:00 committed by GitHub
parent 4b022a4bb1
commit a99932da12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,12 +50,15 @@ static QString RefToDisplayString(ControlReference* ref)
controls[i] = qualifier.has_device ? QStringLiteral(":") : QString();
controls[i].append(QString::fromStdString(qualifier.control_name));
}
else
{
controls[i].remove(QLatin1Char{' '});
}
}
}
// Do not re-add "`" to the final string, we don't need to see it.
expression = controls.join(QStringLiteral(""));
expression.remove(QLatin1Char{' '});
expression.remove(QLatin1Char{'\t'});
expression.remove(QLatin1Char{'\n'});
expression.remove(QLatin1Char{'\r'});