feat: add in-window search bar to who results window

Add a search field with "Search" button directly in the who results
window so players can query without using the chat box. Pressing Enter
in the search field also triggers a new /who query.
This commit is contained in:
Kelsi 2026-03-12 10:45:31 -07:00
parent 367390a852
commit 36d40905e1

View file

@ -16862,8 +16862,23 @@ void GameScreen::renderWhoWindow(game::GameHandler& gameHandler) {
return; return;
} }
// Search bar with Send button
static char whoSearchBuf[64] = {};
bool doSearch = false;
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 60.0f);
if (ImGui::InputTextWithHint("##whosearch", "Search players...", whoSearchBuf, sizeof(whoSearchBuf),
ImGuiInputTextFlags_EnterReturnsTrue))
doSearch = true;
ImGui::SameLine();
if (ImGui::Button("Search", ImVec2(-1, 0)))
doSearch = true;
if (doSearch) {
gameHandler.queryWho(std::string(whoSearchBuf));
}
ImGui::Separator();
if (results.empty()) { if (results.empty()) {
ImGui::TextDisabled("No results. Use /who [filter] to search."); ImGui::TextDisabled("No results. Type a filter above or use /who [filter].");
ImGui::End(); ImGui::End();
return; return;
} }