Skip to content

Commit

Permalink
Click on empty space in row to clear highlight
Browse files Browse the repository at this point in the history
Resolves #116
  • Loading branch information
encounter committed Oct 8, 2024
1 parent ab2e84a commit 6fb0a63
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion objdiff-gui/src/views/function_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ impl FunctionViewState {
}
}
}

fn clear_highlight(&mut self) {
self.left_highlight = HighlightKind::None;
self.right_highlight = HighlightKind::None;
}
}

fn ins_hover_ui(
Expand Down Expand Up @@ -397,6 +402,7 @@ fn asm_table_ui(
};
table.body(|body| {
body.rows(appearance.code_font.size, instructions_len, |mut row| {
row.set_hovered(false); // Disable row hover effect
if let (Some(left_obj), Some(left_symbol_ref)) = (left_obj, left_symbol) {
asm_col_ui(
&mut row,
Expand All @@ -421,6 +427,9 @@ fn asm_table_ui(
} else {
empty_col_ui(&mut row);
}
if row.response().clicked() {
ins_view_state.clear_highlight();
}
});
});
Some(())
Expand Down Expand Up @@ -559,7 +568,8 @@ pub fn function_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance
.columns(Column::exact(column_width).clip(true), 2)
.resizable(false)
.auto_shrink([false, false])
.min_scrolled_height(available_height);
.min_scrolled_height(available_height)
.sense(Sense::click());
asm_table_ui(
table,
result.first_obj.as_ref(),
Expand Down

0 comments on commit 6fb0a63

Please sign in to comment.