VirtualBox

Changeset 78484 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 13, 2019 1:36:02 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130522
Message:

FE/Qt: bugref:9072. Using block count instead of line count.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp

    r78462 r78484  
    2727#include <QLineEdit>
    2828#include <QPlainTextEdit>
     29#include <QScrollBar>
    2930#include <QTextBlock>
    3031
     
    494495    QTextCursor cursor(pDocument);
    495496    QTextDocument::FindFlags flags = constructFindFlags(ForwardSearch);
    496     int lineCount = pDocument->lineCount();
     497    int blockCount = pDocument->blockCount();
    497498    while (!cursor.isNull() && !cursor.atEnd())
    498499    {
     
    504505            /* The following assumes we have single line blocks only: */
    505506            int cursorLine = pDocument->findBlock(cursor.position()).blockNumber();
    506             if (lineCount != 0)
    507                 m_matchLocationVector.push_back(cursorLine / static_cast<float>(lineCount));
     507            if (blockCount != 0)
     508                m_matchLocationVector.push_back(cursorLine / static_cast<float>(blockCount));
    508509        }
    509510    }
     
    523524    cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex), QTextCursor::MoveAnchor);
    524525    /* Move the cursor to the end of the matched string while keeping the anchor at the begining thus selecting the text: */
    525     cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex)+searchString.length(), QTextCursor::KeepAnchor);
     526    cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex) + searchString.length(), QTextCursor::KeepAnchor);
     527    textEdit()->ensureCursorVisible();
    526528    textEdit()->setTextCursor(cursor);
    527529    return;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette