Restore context menu on highlightable fields

Fixes #30
This commit is contained in:
Luke Street 2023-10-07 13:04:08 -04:00
parent e68629c339
commit e1dc84698f
1 changed files with 15 additions and 3 deletions

View File

@ -163,7 +163,11 @@ fn write_ins(
} else { } else {
Color32::TRANSPARENT Color32::TRANSPARENT
}); });
if ui.add(Label::new(op_label).sense(Sense::click())).clicked() { if ui
.add(Label::new(op_label).sense(Sense::click()))
.context_menu(|ui| ins_context_menu(ui, ins))
.clicked()
{
if highlighted_op { if highlighted_op {
ins_view_state.highlight = HighlightKind::None; ins_view_state.highlight = HighlightKind::None;
} else { } else {
@ -262,7 +266,11 @@ fn write_ins(
write_text(")", base_color, &mut job, appearance.code_font.clone()); write_text(")", base_color, &mut job, appearance.code_font.clone());
} }
writing_offset = new_writing_offset; writing_offset = new_writing_offset;
if ui.add(Label::new(job).sense(Sense::click())).clicked() { if ui
.add(Label::new(job).sense(Sense::click()))
.context_menu(|ui| ins_context_menu(ui, ins))
.clicked()
{
if highlighted_arg { if highlighted_arg {
ins_view_state.highlight = HighlightKind::None; ins_view_state.highlight = HighlightKind::None;
} else if matches!(arg, ObjInsArg::Reloc | ObjInsArg::RelocWithBase) { } else if matches!(arg, ObjInsArg::Reloc | ObjInsArg::RelocWithBase) {
@ -444,7 +452,11 @@ fn asm_row_ui(
}, },
..Default::default() ..Default::default()
}); });
if ui.add(Label::new(job).sense(Sense::click())).clicked() { if ui
.add(Label::new(job).sense(Sense::click()))
.context_menu(|ui| ins_context_menu(ui, ins))
.clicked()
{
if addr_highlight { if addr_highlight {
ins_view_state.highlight = HighlightKind::None; ins_view_state.highlight = HighlightKind::None;
} else { } else {