When the searchbox (via F3) is opened, the user cannot:
- Jump to the very last item when the active item is the very first item using the UP arrow key.
- Jump to the very first item when the active item is the very last item using the DOWN arrow key.
This patch adds two additional struct members to uiSearchItems (bool will_count_total_matches and unsigned int total_matches) so that it can tell when to calculate the total_matches (which is the actual total number of items that is a possible match based on the search string). It will only count the total number of matches when the active item in the search bar is the very first one (as an optimization). total_matches is used to count the number of items we need to skip from this code.
Also, I check if Object *ob is not NULL in source/blender/editors/sculpt_paint/sculpt.c : static bool sculpt_no_multires_poll because Blender would crash if I delete the cube and perform a search (F3) in the 'default scene' when you first open Blender.