Commit 57367f70 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

More quickopen performance improvement

parent f1964ef4
......@@ -284,7 +284,11 @@ bool KateQuickOpen::eventFilter(QObject *obj, QEvent *event)
if (keyEvent->key() == Qt::Key_Escape) {
m_mainWindow->slotWindowActivated();
m_inputLine->clear();
{
m_inputLine->blockSignals(true);
m_inputLine->clear();
m_inputLine->blockSignals(false);
}
keyEvent->accept();
hide();
return true;
......@@ -302,7 +306,11 @@ bool KateQuickOpen::eventFilter(QObject *obj, QEvent *event)
// hide on focus out, if neither input field nor list have focus!
else if (event->type() == QEvent::FocusOut && !(m_inputLine->hasFocus() || m_listView->hasFocus())) {
m_mainWindow->slotWindowActivated();
m_inputLine->clear();
{
m_inputLine->blockSignals(true);
m_inputLine->clear();
m_inputLine->blockSignals(false);
}
hide();
return true;
}
......
......@@ -85,6 +85,25 @@ static bool fuzzy_match_simple(const QStringView pattern, const QStringView str)
static bool fuzzy_match(const QStringView pattern, const QStringView str, int &outScore)
{
// simple substring matching to flush out non-matching stuff
auto patternIt = pattern.cbegin();
bool lower = patternIt->isLower();
QChar cUp = lower ? patternIt->toUpper() : *patternIt;
QChar cLow = lower ? *patternIt : patternIt->toLower();
for (auto strIt = str.cbegin(); strIt != str.cend() && patternIt != pattern.cend(); ++strIt) {
if (*strIt == cLow || *strIt == cUp) {
++patternIt;
lower = patternIt->isLower();
cUp = lower ? patternIt->toUpper() : *patternIt;
cLow = lower ? *patternIt : patternIt->toLower();
}
}
if (patternIt != pattern.cend()) {
outScore = 0;
return false;
}
uint8_t matches[256];
return fuzzy_match(pattern, str, outScore, matches);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment