mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 13:06:39 +00:00
Simplify regex search in the editor
This commit is contained in:
parent
94259317bb
commit
7c709167d9
1 changed files with 5 additions and 7 deletions
|
@ -48,20 +48,18 @@ void CSMTools::Search::searchRegExCell(const CSMWorld::IdTableBase* model, const
|
||||||
{
|
{
|
||||||
QString text = model->data(index).toString();
|
QString text = model->data(index).toString();
|
||||||
|
|
||||||
int pos = 0;
|
QRegularExpressionMatchIterator i = mRegExp.globalMatch(text);
|
||||||
QRegularExpressionMatch match;
|
while (i.hasNext())
|
||||||
|
|
||||||
while ((match = mRegExp.match(text, pos)).hasMatch())
|
|
||||||
{
|
{
|
||||||
pos = match.capturedStart();
|
QRegularExpressionMatch match = i.next();
|
||||||
|
|
||||||
|
int pos = match.capturedStart();
|
||||||
int length = match.capturedLength();
|
int length = match.capturedLength();
|
||||||
|
|
||||||
std::ostringstream hint;
|
std::ostringstream hint;
|
||||||
hint << (writable ? 'R' : 'r') << ": " << model->getColumnId(index.column()) << " " << pos << " " << length;
|
hint << (writable ? 'R' : 'r') << ": " << model->getColumnId(index.column()) << " " << pos << " " << length;
|
||||||
|
|
||||||
messages.add(id, formatDescription(text, pos, length).toUtf8().data(), hint.str());
|
messages.add(id, formatDescription(text, pos, length).toUtf8().data(), hint.str());
|
||||||
|
|
||||||
pos += length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue