^F opens find zone menu and focuses on the input box.

This commit is contained in:
Bartosz Taudul 2018-12-22 17:39:22 +01:00
parent 2d143ce516
commit ea396354d0

View File

@ -489,6 +489,7 @@ bool View::DrawImpl()
{ {
if( ImGui::IsKeyPressed( 'F' ) ) if( ImGui::IsKeyPressed( 'F' ) )
{ {
m_findZone.show = true;
m_shortcut = ShortcutAction::OpenFind; m_shortcut = ShortcutAction::OpenFind;
} }
} }
@ -4648,6 +4649,8 @@ uint64_t View::GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::G
void View::DrawFindZone() void View::DrawFindZone()
{ {
if( m_shortcut == ShortcutAction::OpenFind ) ImGui::SetNextWindowFocus();
ImGui::Begin( "Find zone", &m_findZone.show ); ImGui::Begin( "Find zone", &m_findZone.show );
#ifdef TRACY_NO_STATISTICS #ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Collection of statistical data is disabled in this build." ); ImGui::TextWrapped( "Collection of statistical data is disabled in this build." );
@ -4663,6 +4666,11 @@ void View::DrawFindZone()
bool findClicked = false; bool findClicked = false;
ImGui::PushItemWidth( -0.01f ); ImGui::PushItemWidth( -0.01f );
if( m_shortcut == ShortcutAction::OpenFind )
{
ImGui::SetKeyboardFocusHere();
m_shortcut = ShortcutAction::None;
}
findClicked |= ImGui::InputText( "", m_findZone.pattern, 1024, ImGuiInputTextFlags_EnterReturnsTrue ); findClicked |= ImGui::InputText( "", m_findZone.pattern, 1024, ImGuiInputTextFlags_EnterReturnsTrue );
ImGui::PopItemWidth(); ImGui::PopItemWidth();