| 461 | } |
| 462 | |
| 463 | char *CBinds::GetKeyBindCommand(int ModifierCombination, int Key) const |
| 464 | { |
| 465 | char aBindName[128]; |
| 466 | GetKeyBindName(Key, ModifierCombination, aBindName, sizeof(aBindName)); |
| 467 | // worst case the str_escape can double the string length |
| 468 | int Size = str_length(m_aapKeyBindings[ModifierCombination][Key]) * 2 + str_length(aBindName) + 16; |
| 469 | auto *pBuf = static_cast<char *>(malloc(Size)); |
| 470 | str_format(pBuf, Size, "bind %s \"", aBindName); |
| 471 | char *pDst = pBuf + str_length(pBuf); |
| 472 | // process the string. we need to escape some characters |
| 473 | str_escape(&pDst, m_aapKeyBindings[ModifierCombination][Key], pBuf + Size); |
| 474 | str_append(pBuf, "\"", Size); |
| 475 | return pBuf; |
| 476 | } |
| 477 | |
| 478 | void CBinds::ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserData) |
| 479 | { |
no test coverage detected