Skip to content

Commit 6fb0a63

Browse files
committed
Click on empty space in row to clear highlight
Resolves #116
1 parent ab2e84a commit 6fb0a63

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

objdiff-gui/src/views/function_diff.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ impl FunctionViewState {
6565
}
6666
}
6767
}
68+
69+
fn clear_highlight(&mut self) {
70+
self.left_highlight = HighlightKind::None;
71+
self.right_highlight = HighlightKind::None;
72+
}
6873
}
6974

7075
fn ins_hover_ui(
@@ -397,6 +402,7 @@ fn asm_table_ui(
397402
};
398403
table.body(|body| {
399404
body.rows(appearance.code_font.size, instructions_len, |mut row| {
405+
row.set_hovered(false); // Disable row hover effect
400406
if let (Some(left_obj), Some(left_symbol_ref)) = (left_obj, left_symbol) {
401407
asm_col_ui(
402408
&mut row,
@@ -421,6 +427,9 @@ fn asm_table_ui(
421427
} else {
422428
empty_col_ui(&mut row);
423429
}
430+
if row.response().clicked() {
431+
ins_view_state.clear_highlight();
432+
}
424433
});
425434
});
426435
Some(())
@@ -559,7 +568,8 @@ pub fn function_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance
559568
.columns(Column::exact(column_width).clip(true), 2)
560569
.resizable(false)
561570
.auto_shrink([false, false])
562-
.min_scrolled_height(available_height);
571+
.min_scrolled_height(available_height)
572+
.sense(Sense::click());
563573
asm_table_ui(
564574
table,
565575
result.first_obj.as_ref(),

0 commit comments

Comments
 (0)