mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	InputText: Fixed a bug where ESCAPE would be first captured by the Keyboard Navigation code. (#2321, #787)
This commit is contained in:
		@@ -36,6 +36,7 @@ HOW TO UPDATE?
 | 
			
		||||
Other Changes:
 | 
			
		||||
- Added .editorconfig file for text editors to standardize using spaces. (#2038) [@kudaba]
 | 
			
		||||
- InputText: Fixed a bug where ESCAPE would not restore the initial value in all situations. (#2321) [@relick]
 | 
			
		||||
- InputText: Fixed a bug where ESCAPE would be first captured by the Keyboard Navigation code. (#2321, #787)
 | 
			
		||||
- Fixed range-version of PushID() and GetID() not honoring the ### operator to restart from the seed value.
 | 
			
		||||
- Fixed CloseCurrentPopup() on a child-menu of a modal incorrectly closing the modal. (#2308)
 | 
			
		||||
- Window: When resizing from an edge, the border is more visible and better follow the rounded corners.
 | 
			
		||||
 
 | 
			
		||||
@@ -2644,6 +2644,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
 | 
			
		||||
    }
 | 
			
		||||
    g.ActiveId = id;
 | 
			
		||||
    g.ActiveIdAllowNavDirFlags = 0;
 | 
			
		||||
    g.ActiveIdBlockNavInputFlags = 0;
 | 
			
		||||
    g.ActiveIdAllowOverlap = false;
 | 
			
		||||
    g.ActiveIdWindow = window;
 | 
			
		||||
    if (id)
 | 
			
		||||
@@ -7630,7 +7631,8 @@ static void ImGui::NavUpdate()
 | 
			
		||||
    {
 | 
			
		||||
        if (g.ActiveId != 0)
 | 
			
		||||
        {
 | 
			
		||||
            ClearActiveID();
 | 
			
		||||
            if (!(g.ActiveIdBlockNavInputFlags & (1 << ImGuiNavInput_Cancel)))
 | 
			
		||||
                ClearActiveID();
 | 
			
		||||
        }
 | 
			
		||||
        else if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow) && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow)
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -777,6 +777,7 @@ struct ImGuiContext
 | 
			
		||||
    bool                    ActiveIdPreviousFrameIsAlive;
 | 
			
		||||
    bool                    ActiveIdPreviousFrameHasBeenEdited;
 | 
			
		||||
    int                     ActiveIdAllowNavDirFlags;           // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
 | 
			
		||||
    int                     ActiveIdBlockNavInputFlags;
 | 
			
		||||
    ImVec2                  ActiveIdClickOffset;                // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
 | 
			
		||||
    ImGuiWindow*            ActiveIdWindow;
 | 
			
		||||
    ImGuiWindow*            ActiveIdPreviousFrameWindow;
 | 
			
		||||
@@ -931,7 +932,8 @@ struct ImGuiContext
 | 
			
		||||
        ActiveIdHasBeenEdited = false;
 | 
			
		||||
        ActiveIdPreviousFrameIsAlive = false;
 | 
			
		||||
        ActiveIdPreviousFrameHasBeenEdited = false;
 | 
			
		||||
        ActiveIdAllowNavDirFlags = 0;
 | 
			
		||||
        ActiveIdAllowNavDirFlags = 0x00;
 | 
			
		||||
        ActiveIdBlockNavInputFlags = 0x00;
 | 
			
		||||
        ActiveIdClickOffset = ImVec2(-1,-1);
 | 
			
		||||
        ActiveIdWindow = ActiveIdPreviousFrameWindow = NULL;
 | 
			
		||||
        ActiveIdSource = ImGuiInputSource_None;
 | 
			
		||||
 
 | 
			
		||||
@@ -2628,6 +2628,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const c
 | 
			
		||||
    SetActiveID(g.ScalarAsInputTextId, window);
 | 
			
		||||
    SetHoveredID(0);
 | 
			
		||||
    g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
 | 
			
		||||
    g.ActiveIdBlockNavInputFlags = (1 << ImGuiNavInput_Cancel);
 | 
			
		||||
 | 
			
		||||
    char fmt_buf[32];
 | 
			
		||||
    char data_buf[32];
 | 
			
		||||
@@ -3257,8 +3258,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
 | 
			
		||||
        SetActiveID(id, window);
 | 
			
		||||
        SetFocusID(id, window);
 | 
			
		||||
        FocusWindow(window);
 | 
			
		||||
        g.ActiveIdBlockNavInputFlags = (1 << ImGuiNavInput_Cancel);
 | 
			
		||||
        if (!is_multiline && !(flags & ImGuiInputTextFlags_CallbackHistory))
 | 
			
		||||
            g.ActiveIdAllowNavDirFlags |= ((1 << ImGuiDir_Up) | (1 << ImGuiDir_Down));
 | 
			
		||||
            g.ActiveIdAllowNavDirFlags = ((1 << ImGuiDir_Up) | (1 << ImGuiDir_Down));
 | 
			
		||||
    }
 | 
			
		||||
    else if (io.MouseClicked[0])
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user