Commit c2105380 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Extra point for already opened file

If a file is already opened, give it one extra point. This gives priority
to opened files over non-opened ones by a slight margin and is mainly
useful for cases where you have two files with very similar names and
same score.

kate.h => opened
kate.cpp => not opened

both have same score, but if .h is opened, it will appear above cpp
parent 01abd0d5
......@@ -87,6 +87,11 @@ protected:
res = res || resp;
}
if (res) {
// +1 point for opened files
score += (sm->isOpened(sourceRow));
}
sm->setScoreForIndex(sourceRow, score);
return res;
......
......@@ -91,6 +91,11 @@ public:
return m_modelEntries.at(idx.row()).document;
}
bool isOpened(int row) const
{
return m_modelEntries.at(row).document;
}
private:
std::vector<ModelEntry> m_modelEntries;
QString m_projectBase;
......
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