From 163d750a0dd7ab25bdc60c78b9a43c199e9372aa Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sun, 5 Nov 2023 15:16:44 -0500 Subject: [PATCH] Arsenal - Use forceUnicode for search functions (#9605) * use forceUnicode * Update fnc_attributeAddItems.sqf * Update fnc_handleSearchbar.sqf --- addons/arsenal/functions/fnc_attributeAddItems.sqf | 12 ++++++++---- addons/arsenal/functions/fnc_handleSearchbar.sqf | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/addons/arsenal/functions/fnc_attributeAddItems.sqf b/addons/arsenal/functions/fnc_attributeAddItems.sqf index 2b1775acec..5457a920a2 100644 --- a/addons/arsenal/functions/fnc_attributeAddItems.sqf +++ b/addons/arsenal/functions/fnc_attributeAddItems.sqf @@ -18,9 +18,10 @@ params ["_controlsGroup"]; +forceUnicode 0; // handle non-ANSI characters + private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY); -// Have to use toLower here and displayName to handle non-ANSI characters -private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR); +private _filter = ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR); private _configItems = uiNamespace getVariable QGVAR(configItems); private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems); private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]]; @@ -67,7 +68,7 @@ if (_category == IDX_CAT_ALL) exitWith { _displayName = getText (_config >> "displayName"); // Add item if not filtered - if (toLower _displayName regexMatch _filter || {_x regexMatch _filter}) then { + if (_displayName regexMatch _filter || {_x regexMatch _filter}) then { _index = _listbox lnbAddRow ["", _displayName, _modeSymbol]; _listbox lnbSetData [[_index, 1], _x]; _listbox lnbSetPicture [[_index, 0], getText (_config >> "picture")]; @@ -119,7 +120,7 @@ private _config = _cfgClass; _displayName = getText (_config >> _x >> "displayName"); // Add item if not filtered - if (toLower _displayName regexMatch _filter || {_x regexMatch _filter}) then { + if (_displayName regexMatch _filter || {_x regexMatch _filter}) then { // Change symbol and alpha if item already selected if (_x in _attributeItems) then { _symbol = _modeSymbol; @@ -140,3 +141,6 @@ private _config = _cfgClass; // Sort alphabetically _listbox lnbSort [1, false]; + +// Reset unicode flag +forceUnicode -1; diff --git a/addons/arsenal/functions/fnc_handleSearchbar.sqf b/addons/arsenal/functions/fnc_handleSearchbar.sqf index 592096b640..d25a064867 100644 --- a/addons/arsenal/functions/fnc_handleSearchbar.sqf +++ b/addons/arsenal/functions/fnc_handleSearchbar.sqf @@ -17,8 +17,9 @@ params ["_display", "_control", ["_animate", true]]; -// Have to use toLower here and displayName to handle non-ANSI characters -private _searchString = toLower ctrlText _control; +forceUnicode 0; // handle non-ANSI characters + +private _searchString = ctrlText _control; private _searchPattern = ""; if (_searchString != "") then { _searchPattern = _searchString call EFUNC(common,escapeRegex); @@ -56,7 +57,7 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then { // Go through all items in panel and see if they need to be deleted or not for "_lbIndex" from (lbSize _rightPanelCtrl) - 1 to 0 step -1 do { - _currentDisplayName = toLower (_rightPanelCtrl lbText _lbIndex); + _currentDisplayName = _rightPanelCtrl lbText _lbIndex; _currentClassname = _rightPanelCtrl lbData _lbIndex; // Remove item in panel if it doesn't match search, skip otherwise @@ -152,7 +153,7 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then { // Go through all items in panel and see if they need to be deleted or not for "_lbIndex" from (lbSize _leftPanelCtrl) - 1 to 0 step -1 do { - _currentDisplayName = toLower (_leftPanelCtrl lbText _lbIndex); + _currentDisplayName = _leftPanelCtrl lbText _lbIndex; _currentClassname = _leftPanelCtrl lbData _lbIndex; // Remove item in panel if it doesn't match search, skip otherwise @@ -178,3 +179,6 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then { [_display, nil, nil, configNull] call FUNC(itemInfo); }; + +// Reset unicode flag +forceUnicode -1;