Skip to content

Commit

Permalink
fix source code search
Browse files Browse the repository at this point in the history
The search functions only works on a limited range, but the model
contained the complete source code. This patch runs the search function
on only a subset of that code.
fixes: #577
  • Loading branch information
lievenhey committed Jan 16, 2024
1 parent 385bbcd commit bcc26d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/sourcecodemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ void SourceCodeModel::find(const QString& search, Direction direction, int curre
auto searchFunc = [&search](const QString& line) { return line.indexOf(search, 0, Qt::CaseInsensitive) != -1; };

auto endReached = [this] { emit searchEndReached(); };

const int resultIndex = ::search(m_lines, current, direction, searchFunc, endReached);
qDebug() << m_lines.mid(m_startLine, m_numLines);
const int resultIndex = ::search(m_lines.mid(m_startLine, m_numLines), current, direction, searchFunc, endReached);

if (resultIndex >= 0) {
emit resultFound(createIndex(resultIndex + 1, SourceCodeColumn));
Expand Down

0 comments on commit bcc26d3

Please sign in to comment.