Skip to content

Commit 63552a5

Browse files
committed
Move copy button to first header row
1 parent 827f4a4 commit 63552a5

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

objdiff-gui/src/views/diff.rs

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ pub fn diff_view_ui(
213213
ret = Some(DiffViewAction::CreateScratch(symbol.name.clone()));
214214
}
215215
}
216+
217+
if state.current_view == View::FunctionDiff
218+
&& let Some((_, symbol_diff, symbol_idx)) = left_ctx.symbol
219+
&& let Some((obj, _)) = left_ctx.obj
220+
&& ui
221+
.button("📋 Copy")
222+
.on_hover_text_at_pointer("Copy all rows to clipboard")
223+
.clicked()
224+
{
225+
ui.ctx().copy_text(get_asm_text(obj, symbol_diff, symbol_idx, diff_config));
226+
}
216227
});
217228
}
218229

@@ -272,19 +283,6 @@ pub fn diff_view_ui(
272283
{
273284
ret = Some(DiffViewAction::SelectingLeft(symbol_ref.clone()));
274285
}
275-
276-
// Copy target ASM button.
277-
if state.current_view == View::FunctionDiff
278-
&& let Some((_, symbol_diff, symbol_idx)) = left_ctx.symbol
279-
&& let Some((obj, _)) = left_ctx.obj
280-
&& ui
281-
.button("📋 Copy ASM")
282-
.on_hover_text_at_pointer("Copy assembly to clipboard")
283-
.clicked()
284-
{
285-
let asm_text = get_asm_text(obj, symbol_diff, symbol_idx, diff_config);
286-
ui.ctx().copy_text(asm_text);
287-
}
288286
});
289287
} else if left_ctx.status.success && !left_ctx.has_symbol() {
290288
ui.horizontal(|ui| {
@@ -359,6 +357,15 @@ pub fn diff_view_ui(
359357
{
360358
ret = Some(DiffViewAction::OpenSourcePath);
361359
}
360+
if let Some((_, symbol_diff, symbol_idx)) = right_ctx.symbol
361+
&& let Some((obj, _)) = right_ctx.obj
362+
&& ui
363+
.button("📋 Copy")
364+
.on_hover_text_at_pointer("Copy all rows to clipboard")
365+
.clicked()
366+
{
367+
ui.ctx().copy_text(get_asm_text(obj, symbol_diff, symbol_idx, diff_config));
368+
}
362369
});
363370

364371
// Second row
@@ -442,18 +449,6 @@ pub fn diff_view_ui(
442449
{
443450
ret = Some(DiffViewAction::SelectingRight(symbol_ref.clone()));
444451
}
445-
446-
// Copy base ASM button.
447-
if let Some((_, symbol_diff, symbol_idx)) = right_ctx.symbol
448-
&& let Some((obj, _)) = right_ctx.obj
449-
&& ui
450-
.button("📋 Copy ASM")
451-
.on_hover_text_at_pointer("Copy assembly to clipboard")
452-
.clicked()
453-
{
454-
let asm_text = get_asm_text(obj, symbol_diff, symbol_idx, diff_config);
455-
ui.ctx().copy_text(asm_text);
456-
}
457452
}
458453
} else if right_ctx.status.success && !right_ctx.has_symbol() {
459454
let mut search = state.search.clone();

0 commit comments

Comments
 (0)