From 5ccb0e0096dff6c2bbdfa959610620a14fdc918d Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 9 Mar 2021 11:57:04 +0200 Subject: LookupWidget: Fixed use of multiple search terms The regexp wasn't formed correctly. --- src/ui/lookupwidget.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index eabfc7d2..29ae0fee 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c @@ -325,12 +325,12 @@ static iThreadResult worker_LookupWidget_(iThread *thread) { iString *pattern = new_String(); iRangecc word = iNullRange; iBool isFirst = iTrue; + iString wordStr; + init_String(&wordStr); while (nextSplit_Rangecc(range_String(&d->pendingTerm), " ", &word)) { if (isEmpty_Range(&word)) continue; if (!isFirst) appendCStr_String(pattern, ".*"); - const iString wordStr = { iBlockLiteral(word.start, - word.end - word.start, - word.end - word.start) }; + setRange_String(&wordStr, word); iConstForEach(String, ch, &wordStr) { /* Escape regular expression characters. */ if (isSyntaxChar_RegExp(ch.value)) { @@ -340,6 +340,7 @@ static iThreadResult worker_LookupWidget_(iThread *thread) { } isFirst = iFalse; } + deinit_String(&wordStr); iAssert(!isEmpty_String(pattern)); job->term = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption); delete_String(pattern); -- cgit v1.2.3