mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
TagExplorer: use RegularExpression instead of WholeWordOnly when searching for a tag
"\bc#\b" won't match a word. We use "^c#$" instead.
This commit is contained in:
parent
0ae6b1a810
commit
47503fddfe
@ -223,13 +223,16 @@ bool VTagExplorer::activateTag(const QString &p_tag)
|
|||||||
QVector<VNotebook *> notebooks;
|
QVector<VNotebook *> notebooks;
|
||||||
notebooks.append(m_notebook);
|
notebooks.append(m_notebook);
|
||||||
getVSearch()->clear();
|
getVSearch()->clear();
|
||||||
|
// We could not use WholeWordOnly here, since "c#" won't match a word.
|
||||||
|
int opts = VSearchConfig::CaseSensitive | VSearchConfig::RegularExpression;
|
||||||
|
QString pattern = QRegExp::escape(p_tag);
|
||||||
|
pattern = "^" + pattern + "$";
|
||||||
QSharedPointer<VSearchConfig> config(new VSearchConfig(VSearchConfig::CurrentNotebook,
|
QSharedPointer<VSearchConfig> config(new VSearchConfig(VSearchConfig::CurrentNotebook,
|
||||||
VSearchConfig::Tag,
|
VSearchConfig::Tag,
|
||||||
VSearchConfig::Note,
|
VSearchConfig::Note,
|
||||||
VSearchConfig::Internal,
|
VSearchConfig::Internal,
|
||||||
VSearchConfig::CaseSensitive
|
opts,
|
||||||
| VSearchConfig::WholeWordOnly,
|
pattern,
|
||||||
p_tag,
|
|
||||||
QString()));
|
QString()));
|
||||||
getVSearch()->setConfig(config);
|
getVSearch()->setConfig(config);
|
||||||
QSharedPointer<VSearchResult> result = getVSearch()->search(notebooks);
|
QSharedPointer<VSearchResult> result = getVSearch()->search(notebooks);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user