Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp	(revision 78483)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp	(revision 78484)
@@ -27,4 +27,5 @@
 #include <QLineEdit>
 #include <QPlainTextEdit>
+#include <QScrollBar>
 #include <QTextBlock>
 
@@ -494,5 +495,5 @@
     QTextCursor cursor(pDocument);
     QTextDocument::FindFlags flags = constructFindFlags(ForwardSearch);
-    int lineCount = pDocument->lineCount();
+    int blockCount = pDocument->blockCount();
     while (!cursor.isNull() && !cursor.atEnd())
     {
@@ -504,6 +505,6 @@
             /* The following assumes we have single line blocks only: */
             int cursorLine = pDocument->findBlock(cursor.position()).blockNumber();
-            if (lineCount != 0)
-                m_matchLocationVector.push_back(cursorLine / static_cast<float>(lineCount));
+            if (blockCount != 0)
+                m_matchLocationVector.push_back(cursorLine / static_cast<float>(blockCount));
         }
     }
@@ -523,5 +524,6 @@
     cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex), QTextCursor::MoveAnchor);
     /* Move the cursor to the end of the matched string while keeping the anchor at the begining thus selecting the text: */
-    cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex)+searchString.length(), QTextCursor::KeepAnchor);
+    cursor.setPosition(m_matchedCursorPosition.at(iMatchIndex) + searchString.length(), QTextCursor::KeepAnchor);
+    textEdit()->ensureCursorVisible();
     textEdit()->setTextCursor(cursor);
     return;
