Ver Fonte

TypingSelect: always enable nav highlight.

Otherwise in non multi-select contexts as nav dosn't automatically select result would not always be visible.
ocornut há 1 ano atrás
pai
commit
8a2cd81091
3 ficheiros alterados com 2 adições e 3 exclusões
  1. 0 1
      imgui.cpp
  2. 1 0
      imgui_internal.h
  3. 1 2
      imgui_widgets.cpp

+ 0 - 1
imgui.cpp

@@ -1075,7 +1075,6 @@ static ImVec2           NavCalcPreferredRefPos();
 static void             NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
 static ImGuiWindow*     NavRestoreLastChildNavWindow(ImGuiWindow* window);
 static void             NavRestoreLayer(ImGuiNavLayer layer);
-static void             NavRestoreHighlightAfterMove();
 static int              FindWindowFocusIndex(ImGuiWindow* window);
 
 // Error Checking and Debug Tools

+ 1 - 0
imgui_internal.h

@@ -3016,6 +3016,7 @@ namespace ImGui
     IMGUI_API void          NavMoveRequestApplyResult();
     IMGUI_API void          NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
     IMGUI_API void          NavClearPreferredPosForAxis(ImGuiAxis axis);
+    IMGUI_API void          NavRestoreHighlightAfterMove();
     IMGUI_API void          NavUpdateCurrentWindowIsScrollPushableX();
     IMGUI_API void          SetNavWindow(ImGuiWindow* window);
     IMGUI_API void          SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);

+ 1 - 2
imgui_widgets.cpp

@@ -6730,14 +6730,13 @@ int ImGui::TypingSelectFindMatch(ImGuiTypingSelectRequest* req, int items_count,
 {
     if (req == NULL || req->SelectRequest == false) // Support NULL parameter so both calls can be done from same spot.
         return -1;
-    ImGuiContext& g = *GImGui;
     int idx = -1;
     if (req->SingleCharMode && (req->Flags & ImGuiTypingSelectFlags_AllowSingleCharMode))
         idx = TypingSelectFindNextSingleCharMatch(req, items_count, get_item_name_func, user_data, nav_item_idx);
     else
         idx = TypingSelectFindBestLeadingMatch(req, items_count, get_item_name_func, user_data);
     if (idx != -1)
-        g.NavDisableMouseHover = true;
+        NavRestoreHighlightAfterMove();
     return idx;
 }