Page MenuHome

Fix T78084: Search does not accept text fragments
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Jul 7 2020, 10:15 AM.

Details

Summary

This was reported for the "Add Node" search functionality, but is relevant in other searches as well.

So e.g. when searching for "Separate XYZ", typing "sep", then " " (with the intention to type "X" next) would clear the search field.
Now use the same method (matching against all search words) as in F3 searching ('menu_search_update_fn') in other searches as well [ID search template, objects as properties, finding nodes,...]

This should give a much nicer search experience in general.
Note: this doenst touch other searches in the Dopesheet, Outliner, Filebrowser or User Preferences that have other search implementations.

Diff Detail

Repository
rB Blender
Branch
T78084 (branched from master)
Build Status
Buildable 9942
Build 9942: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Jul 7 2020, 10:15 AM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/editors/interface/interface.c
6623

Took me a while to understand what this is checking exactly. Maybe this change makes it easier to understand.

const bool all_words_matched = (index == words_len);
if (all_words_matched) { ... }
This revision is now accepted and ready to land.Jul 7 2020, 12:42 PM

This could mention the same method is used in menu_search_update_fn, so any changes are made in both places.

Assuming above's points were addressed, looks good.

Just talked to @Campbell Barton (campbellbarton) and we agreed this could also be good for ID search, will add that in a bit as well...

also use this multi-word method in other places [ID search template, objects as properties, node finding operator] and make this a general function

Philipp Oeser (lichtwerk) retitled this revision from Fix T78084: Search in enums does not accept text fragments to Fix T78084: Search does not accept text fragments.Jul 8 2020, 3:39 PM
Philipp Oeser (lichtwerk) edited the summary of this revision. (Show Details)

Since I made this a bit more general and used in more places, would appreciate a second review pass, thx in advance!

source/blender/blenlib/intern/string.c
527

You might want to add unit tests in BLI_string_test.cc.

source/blender/editors/interface/interface.c
6614

Since you are refactoring now, might be nice to extract this (str_len / 2) + 1 expression into a function like uint BLI_string_max_possible_word_count(const uint len).

ogierm awarded a token.Jul 8 2020, 6:39 PM

from review: make max word count a function

Philipp Oeser (lichtwerk) marked 2 inline comments as done.Jul 10 2020, 7:39 PM

If you commit this I can use it for property search : )

It may make sense to look at the use of uint again given the section recently added to the style guide: https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Integer_Types

If you commit this I can use it for property search : )

It may make sense to look at the use of uint again given the section recently added to the style guide: https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Integer_Types

on my list for today

on my list for today

make this tomorrow, sorry

No hurry at all! I just saw it and thought it might be useful

respect Integer Types Style Guide

added a test for BLI_string_max_possible_word_count

Philipp Oeser (lichtwerk) marked an inline comment as done.Sep 3 2020, 6:39 PM

So this has seen some (minor) adjustments based on @Jacques Lucke (JacquesLucke) and @Hans Goudey (HooglyBoogly) feedback.
Just to make sure: could you share your pair of eyes another time for final green light? thx in advance!