From 369acebe89c60ca2b93af0f13c051edff34c3701 Mon Sep 17 00:00:00 2001 From: nochinator <61996219+nochinator@users.noreply.github.com> Date: Sun, 7 Jul 2024 08:14:45 -0400 Subject: [PATCH] search box searches for partial matches instead of full match eg. shotgun shows everything with shotgun in the var name, instead of nothing since there is no variable named exactly shotgun but many that have shotgun in the name --- config/ui/vars.cfg | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/config/ui/vars.cfg b/config/ui/vars.cfg index 4ae849e9a..a9105f434 100644 --- a/config/ui/vars.cfg +++ b/config/ui/vars.cfg @@ -188,8 +188,11 @@ newui "vars" $SURFACE_FOREGROUND [ uiallowinput 1 local numvars scurflag scurvar searchstr - searchstr = (concatword $ui_vars_searchstr (? (|| (>= (strstr $ui_vars_searchstr "*") 0) (>= (strstr $ui_vars_searchstr "?") 0)) "" "*")) - numvars = (getvarinfo -1 $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $ui_vars_searchstr 3) + // Remove the restrictive `?` and `*` checks for flexible matching + searchstr = (concatword $ui_vars_searchstr "*") // Using `*` wildcard for broader match + + // Perform a flexible search using the updated `searchstr` + numvars = (getvarinfo -1 $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $searchstr 3) if (>= $ui_vars_num $numvars) [ ui_vars_init ] @@ -205,7 +208,8 @@ newui "vars" $SURFACE_FOREGROUND [ uistyle lefttop uivlist $ui_padbutton [ uistyle lefttop - uiinput ui_vars_searchstr 32 [ui_vars_num = -1] 1 0 "[click here to enter wildcard search text]" 0 [] [uialtrelease [ui_vars_searchstr = ""]] + // Changed the search function to use `ui_vars_searchstr` + uiinput ui_vars_searchstr 32 [ui_vars_num = -1; ui_vars_page = 0] 1 0 "[click here to enter search text]" 0 [] [uialtrelease [ui_vars_searchstr = ""]] uihlist 0 [ uistyle clampx uistyle leftmiddle @@ -281,7 +285,7 @@ newui "vars" $SURFACE_FOREGROUND [ uihlist 0 [ uistyle clampx uialign -1 - ui_vars_curname = (getvarinfo $n $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $ui_vars_searchstr 3) + ui_vars_curname = (getvarinfo $n $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $searchstr 3) uiradio $ui_vars_curname (= $ui_vars_num $n) $ui_radiosize [ui_vars_num = @n] ] ] @@ -316,7 +320,7 @@ newui "vars" $SURFACE_FOREGROUND [ uistyle lefttop uihlist 0 [uispace 0.3] if (&& (>= $ui_vars_num 0) (< $ui_vars_num $numvars) (> $numvars 0)) [ - scurvar = (getvarinfo $ui_vars_num $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $ui_vars_searchstr) + scurvar = (getvarinfo $ui_vars_num $ui_vars_types $ui_vars_notypes $ui_vars_flags $ui_vars_noflags $searchstr) uivlist $ui_padbutton [ uistyle lefttop ui_vars_display $scurvar