summaryrefslogtreecommitdiff
path: root/ui/qt/byte_view_text.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-11-06 22:17:06 +0000
committerGerald Combs <gerald@wireshark.org>2012-11-06 22:17:06 +0000
commit8865f925c21d5acfcdca8e050b5f9981e6298b01 (patch)
treedee432b9e757dca107b7cff02659a4af99e8ac80 /ui/qt/byte_view_text.cpp
parent32074376acc8400f808688660a518d2e827d2edc (diff)
downloadwireshark-8865f925c21d5acfcdca8e050b5f9981e6298b01.tar.gz
Fix our offset calculation.
svn path=/trunk/; revision=45954
Diffstat (limited to 'ui/qt/byte_view_text.cpp')
-rw-r--r--ui/qt/byte_view_text.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/qt/byte_view_text.cpp b/ui/qt/byte_view_text.cpp
index 7f21da3ebb..d4801d8a9d 100644
--- a/ui/qt/byte_view_text.cpp
+++ b/ui/qt/byte_view_text.cpp
@@ -27,6 +27,7 @@
#include "wireshark_application.h"
#include <QTextCursor>
+#include <QTextBlock>
#include <QApplication>
#include <QMouseEvent>
@@ -51,6 +52,7 @@ ByteViewText::ByteViewText(QWidget *parent, tvbuff_t *tvb, proto_tree *tree, QTr
offset_width_(4)
{
setReadOnly(true);
+ setUndoRedoEnabled(false);
setLineWrapMode(QTextEdit::NoWrap);
setState(StateNormal);
@@ -315,8 +317,9 @@ int ByteViewText::flushBytes(QString &str)
void ByteViewText::scrollToByte(int byte)
{
QTextCursor cursor(textCursor());
+ cursor.setPosition(0);
- cursor.setPosition(byte * (per_line_ + 1)); // Newline
+ cursor.setPosition(byte * cursor.block().length() / per_line_);
setTextCursor(cursor);
ensureCursorVisible();
}