Skip to content

Commit

Permalink
Static search result text
Browse files Browse the repository at this point in the history
  • Loading branch information
BttrDrgn committed May 14, 2022
1 parent 298c6aa commit 6062472
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/menus/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,17 @@ void menus::places()

void menus::stations()
{
static char search_text[64];

if (ImGui::BeginMenu("Stations"))
{
ImGui::InputText("##station_search", menus::station_search_buffer, sizeof(menus::station_search_buffer));
ImGui::SameLine();
if (ImGui::Button("Search") && std::strlen(menus::station_search_buffer) > 0)
{
api::search_stations(menus::station_search_buffer);
memset(search_text, 0, sizeof(search_text));
strcpy(search_text, menus::station_search_buffer);
}

if (!api::station_search_results.empty())
Expand All @@ -539,7 +543,7 @@ void menus::stations()
memset(menus::station_search_buffer, 0, sizeof(menus::station_search_buffer));
}

ImGui::Text("Search results for %s", menus::station_search_buffer);
ImGui::Text("Search results for %s", search_text);

for (const station_t& station : api::station_search_results)
{
Expand Down

0 comments on commit 6062472

Please sign in to comment.