| 413 | } |
| 414 | |
| 415 | bool InputManager::PrettifyInputBinding(SmallStringBase& binding, bool use_icons) |
| 416 | { |
| 417 | if (binding.empty()) |
| 418 | return false; |
| 419 | |
| 420 | const std::string_view binding_view = binding.view(); |
| 421 | |
| 422 | SmallString ret; |
| 423 | bool changed = false; |
| 424 | |
| 425 | std::string_view::size_type last = 0; |
| 426 | std::string_view::size_type next; |
| 427 | while ((next = binding_view.find('&', last)) != std::string_view::npos) |
| 428 | { |
| 429 | if (last != next) |
| 430 | { |
| 431 | const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last, next - last)); |
| 432 | if (!part.empty()) |
| 433 | { |
| 434 | if (!ret.empty()) |
| 435 | ret.append(" + "); |
| 436 | PrettifyInputBindingPart(part, ret, changed, use_icons); |
| 437 | } |
| 438 | } |
| 439 | last = next + 1; |
| 440 | } |
| 441 | if (last < (binding_view.size() - 1)) |
| 442 | { |
| 443 | const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last)); |
| 444 | if (!part.empty()) |
| 445 | { |
| 446 | if (!ret.empty()) |
| 447 | ret.append(" + "); |
| 448 | PrettifyInputBindingPart(part, ret, changed, use_icons); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | if (changed) |
| 453 | binding = ret; |
| 454 | |
| 455 | return changed; |
| 456 | } |
| 457 | |
| 458 | void InputManager::SetGamepadIconPreference(InputLayout layout) |
| 459 | { |