summaryrefslogtreecommitdiff
path: root/ui/qt/byte_view_tab.cpp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-02-23 09:30:48 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-02-23 18:30:48 +0000
commitb5ac91399cccdf065d065497c83ca8e8ac864fe7 (patch)
tree79380a0c9d60c926463c5de9ad776191329a4f8c /ui/qt/byte_view_tab.cpp
parent0ef196a643daf3e9654dd118cddbec5c80f7f6ff (diff)
downloadwireshark-b5ac91399cccdf065d065497c83ca8e8ac864fe7.tar.gz
Qt: Select matching tree item and bytes in Find Packet
Highlight the matching tree item and matching packet bytes when doing a Find Packet. Added cf->search_len to correctly highlight the matching bytes when doing a regex search. Bug: 12157 Change-Id: I84fbdb9b43be4355e24aff3cf5f8850f1119e2bf Reviewed-on: https://code.wireshark.org/review/14086 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/byte_view_tab.cpp')
-rw-r--r--ui/qt/byte_view_tab.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp
index 128cc68523..cf405081a4 100644
--- a/ui/qt/byte_view_tab.cpp
+++ b/ui/qt/byte_view_tab.cpp
@@ -267,20 +267,10 @@ void ByteViewTab::protoTreeItemChanged(QTreeWidgetItem *current) {
}
if (cap_file_->search_in_progress && (cap_file_->hex || (cap_file_->string && cap_file_->packet_data))) {
- /* In the hex view, only highlight the target bytes or string. The entire
- field can then be displayed by clicking on any of the bytes in the field. */
- if (cap_file_->hex) {
- const char *p = cap_file_->sfilter;
- f_len = 0;
- while (*p) {
- if (g_ascii_isxdigit(*p++))
- f_len++;
- }
- f_len = (f_len + 1) / 2;
- } else {
- f_len = (int)strlen(cap_file_->sfilter);
- }
- f_start = cap_file_->search_pos - (f_len-1);
+ // In the hex view, only highlight the target bytes or string. The entire
+ // field can then be displayed by clicking on any of the bytes in the field.
+ f_start = cap_file_->search_pos - cap_file_->search_len + 1;
+ f_len = cap_file_->search_len;
} else {
f_start = fi->start;
f_len = fi->length;