Skip to content

Commit 9032e0c

Browse files
Implemented #333
1 parent defc738 commit 9032e0c

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

shv/dll/src/DataItemColumn.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,17 +1168,37 @@ void DataItemColumn::FindNextValue(SharedStr searchText)
11681168
if (!IsDefined(row))
11691169
row = 0;
11701170
SizeT currRow = row;
1171-
auto searchData = const_array_cast<value_type>(aa)->GetLockedDataRead();
1171+
auto searchData = const_array_cast<value_type>(aa)->GetDataRead();
1172+
1173+
// first, try to find exact match
11721174
do{
11731175
++row; if (row == nrRows) row = 0; // go to next row modulo nrRows
11741176
auto recNo = tc->GetRecNo(row);
1175-
dms_assert(recNo < searchData.size());
1177+
assert(recNo < searchData.size());
11761178
if (equal_to(searchData[recNo], searchValue))
11771179
{
11781180
this->GotoRow(row);
11791181
return;
11801182
}
11811183
} while (row != currRow);
1184+
1185+
if constexpr (std::is_same_v<value_type, SharedStr>)
1186+
{
1187+
// then try to find partial match
1188+
do {
1189+
++row; if (row == nrRows) row = 0; // go to next row modulo nrRows
1190+
auto recNo = tc->GetRecNo(row);
1191+
assert(recNo < searchData.size());
1192+
1193+
auto searchStringCRef = searchData[recNo];
1194+
if (std::search(searchStringCRef.begin(), searchStringCRef.end(), searchValue.begin(), searchValue.end()) != searchStringCRef.end())
1195+
{
1196+
this->GotoRow(row);
1197+
return;
1198+
}
1199+
} while (row != currRow);
1200+
}
1201+
11821202
reportF(SeverityTypeID::ST_Warning, "ViewColumn.FindNext: failed finding value %.80s", AsString(searchValue));
11831203
}
11841204
);

0 commit comments

Comments
 (0)