From 63552a58ae5f016bf09a7b451382152d25ba20ed Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 18 Nov 2025 22:22:02 -0700 Subject: [PATCH] Move copy button to first header row --- objdiff-gui/src/views/diff.rs | 45 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/objdiff-gui/src/views/diff.rs b/objdiff-gui/src/views/diff.rs index 7478204..b3f4338 100644 --- a/objdiff-gui/src/views/diff.rs +++ b/objdiff-gui/src/views/diff.rs @@ -213,6 +213,17 @@ pub fn diff_view_ui( ret = Some(DiffViewAction::CreateScratch(symbol.name.clone())); } } + + if state.current_view == View::FunctionDiff + && let Some((_, symbol_diff, symbol_idx)) = left_ctx.symbol + && let Some((obj, _)) = left_ctx.obj + && ui + .button("📋 Copy") + .on_hover_text_at_pointer("Copy all rows to clipboard") + .clicked() + { + ui.ctx().copy_text(get_asm_text(obj, symbol_diff, symbol_idx, diff_config)); + } }); } @@ -272,19 +283,6 @@ pub fn diff_view_ui( { ret = Some(DiffViewAction::SelectingLeft(symbol_ref.clone())); } - - // Copy target ASM button. - if state.current_view == View::FunctionDiff - && let Some((_, symbol_diff, symbol_idx)) = left_ctx.symbol - && let Some((obj, _)) = left_ctx.obj - && ui - .button("📋 Copy ASM") - .on_hover_text_at_pointer("Copy assembly to clipboard") - .clicked() - { - let asm_text = get_asm_text(obj, symbol_diff, symbol_idx, diff_config); - ui.ctx().copy_text(asm_text); - } }); } else if left_ctx.status.success && !left_ctx.has_symbol() { ui.horizontal(|ui| { @@ -359,6 +357,15 @@ pub fn diff_view_ui( { ret = Some(DiffViewAction::OpenSourcePath); } + if let Some((_, symbol_diff, symbol_idx)) = right_ctx.symbol + && let Some((obj, _)) = right_ctx.obj + && ui + .button("📋 Copy") + .on_hover_text_at_pointer("Copy all rows to clipboard") + .clicked() + { + ui.ctx().copy_text(get_asm_text(obj, symbol_diff, symbol_idx, diff_config)); + } }); // Second row @@ -442,18 +449,6 @@ pub fn diff_view_ui( { ret = Some(DiffViewAction::SelectingRight(symbol_ref.clone())); } - - // Copy base ASM button. - if let Some((_, symbol_diff, symbol_idx)) = right_ctx.symbol - && let Some((obj, _)) = right_ctx.obj - && ui - .button("📋 Copy ASM") - .on_hover_text_at_pointer("Copy assembly to clipboard") - .clicked() - { - let asm_text = get_asm_text(obj, symbol_diff, symbol_idx, diff_config); - ui.ctx().copy_text(asm_text); - } } } else if right_ctx.status.success && !right_ctx.has_symbol() { let mut search = state.search.clone();