summaryrefslogtreecommitdiff
path: root/file.c
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 /file.c
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 'file.c')
-rw-r--r--file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/file.c b/file.c
index 1a2e3932f8..39fbd6dc16 100644
--- a/file.c
+++ b/file.c
@@ -3084,6 +3084,7 @@ match_narrow_and_wide(capture_file *cf, frame_data *fdata, void *criterion)
result = MR_MATCHED;
cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
+ cf->search_len = (guint32)textlen;
break;
}
}
@@ -3131,6 +3132,7 @@ match_narrow(capture_file *cf, frame_data *fdata, void *criterion)
result = MR_MATCHED;
cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
+ cf->search_len = (guint32)textlen;
break;
}
}
@@ -3178,6 +3180,7 @@ match_wide(capture_file *cf, frame_data *fdata, void *criterion)
result = MR_MATCHED;
cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
+ cf->search_len = (guint32)textlen;
break;
}
i += 1;
@@ -3221,6 +3224,7 @@ match_binary(capture_file *cf, frame_data *fdata, void *criterion)
result = MR_MATCHED;
cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
+ cf->search_len = (guint32)datalen;
break;
}
}
@@ -3251,7 +3255,8 @@ match_regex(capture_file *cf, frame_data *fdata, void *criterion _U_)
{
gint start_pos = 0, end_pos = 0;
g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos);
- cf->search_pos = end_pos; /* TODO: use start_pos to show correct length for regex */
+ cf->search_pos = end_pos - 1;
+ cf->search_len = end_pos - start_pos;
result = MR_MATCHED;
}
return result;
@@ -3493,6 +3498,7 @@ find_packet(capture_file *cf,
found = packet_list_select_row_from_data(new_fd);
cf->search_in_progress = FALSE;
cf->search_pos = 0; /* Reset the position */
+ cf->search_len = 0; /* Reset length */
if (!found) {
/* We didn't find a row corresponding to this frame.
This means that the frame isn't being displayed currently,