Fixup selected packet arithmetic.

Or, "I can mathing" if you prefer meme-based commit messages.

Change-Id: I8fd1db0e2a1e99525191ae6b33115ef8e38ab2f4
Reviewed-on: https://code.wireshark.org/review/9758
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-07-23 11:19:38 -07:00
parent 9bca127430
commit a5f7b84dba
1 changed files with 3 additions and 1 deletions

View File

@ -1364,6 +1364,8 @@ void PacketList::drawNearOverlay()
cur_line = next_line;
}
// If the selected packet is in the overlay set selected_pos
// accordingly. Otherwise, pin it to either the top or bottom.
if (selectionModel()->hasSelection()) {
int sel_row = selectionModel()->currentIndex().row();
if (sel_row < start) {
@ -1371,7 +1373,7 @@ void PacketList::drawNearOverlay()
} else if (sel_row >= end) {
selected_pos = overlay.height() - 1;
} else {
selected_pos = sel_row * overlay.height() / packet_list_model_->rowCount();
selected_pos = (sel_row - start) * o_height / o_rows;
}
}