@@ -111,7 +111,7 @@ fn get_asm_text(
111
111
} ) ;
112
112
113
113
if result. is_ok ( ) {
114
- asm_text. push_str ( & line) ;
114
+ asm_text. push_str ( line. trim_end ( ) ) ;
115
115
asm_text. push ( '\n' ) ;
116
116
}
117
117
}
@@ -264,35 +264,30 @@ pub fn diff_view_ui(
264
264
// Third row
265
265
if left_ctx. has_symbol ( ) && right_ctx. has_symbol ( ) {
266
266
ui. horizontal ( |ui| {
267
- if state. current_view == View :: FunctionDiff
267
+ if ( state. current_view == View :: FunctionDiff
268
268
&& ui
269
269
. button ( "Change target" )
270
270
. on_hover_text_at_pointer (
271
271
"Choose a different symbol to use as the target" ,
272
272
)
273
273
. clicked ( )
274
- || hotkeys:: consume_change_target_shortcut ( ui. ctx ( ) )
274
+ || hotkeys:: consume_change_target_shortcut ( ui. ctx ( ) ) )
275
+ && let Some ( symbol_ref) = state. symbol_state . right_symbol . as_ref ( )
275
276
{
276
- if let Some ( symbol_ref) = state. symbol_state . right_symbol . as_ref ( ) {
277
- ret = Some ( DiffViewAction :: SelectingLeft ( symbol_ref. clone ( ) ) ) ;
278
- }
277
+ ret = Some ( DiffViewAction :: SelectingLeft ( symbol_ref. clone ( ) ) ) ;
279
278
}
280
279
281
280
// Copy target ASM button.
282
- if state. current_view == View :: FunctionDiff {
283
- if let Some ( ( _, symbol_diff, symbol_idx) ) = left_ctx. symbol {
284
- if let Some ( ( obj, _) ) = left_ctx. obj {
285
- if ui
286
- . button ( "Copy ASM" )
287
- . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
288
- . clicked ( )
289
- {
290
- let asm_text =
291
- get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
292
- ui. ctx ( ) . copy_text ( asm_text) ;
293
- }
294
- }
295
- }
281
+ if state. current_view == View :: FunctionDiff
282
+ && let Some ( ( _, symbol_diff, symbol_idx) ) = left_ctx. symbol
283
+ && let Some ( ( obj, _) ) = left_ctx. obj
284
+ && ui
285
+ . button ( "Copy ASM" )
286
+ . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
287
+ . clicked ( )
288
+ {
289
+ let asm_text = get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
290
+ ui. ctx ( ) . copy_text ( asm_text) ;
296
291
}
297
292
} ) ;
298
293
} else if left_ctx. status . success && !left_ctx. has_symbol ( ) {
@@ -453,18 +448,15 @@ pub fn diff_view_ui(
453
448
}
454
449
455
450
// Copy base ASM button.
456
- if let Some ( ( _, symbol_diff, symbol_idx) ) = right_ctx. symbol {
457
- if let Some ( ( obj, _) ) = right_ctx. obj {
458
- if ui
459
- . button ( "Copy ASM" )
460
- . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
461
- . clicked ( )
462
- {
463
- let asm_text =
464
- get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
465
- ui. ctx ( ) . copy_text ( asm_text) ;
466
- }
467
- }
451
+ if let Some ( ( _, symbol_diff, symbol_idx) ) = right_ctx. symbol
452
+ && let Some ( ( obj, _) ) = right_ctx. obj
453
+ && ui
454
+ . button ( "Copy ASM" )
455
+ . on_hover_text_at_pointer ( "Copy assembly to clipboard" )
456
+ . clicked ( )
457
+ {
458
+ let asm_text = get_asm_text ( obj, symbol_diff, symbol_idx, diff_config) ;
459
+ ui. ctx ( ) . copy_text ( asm_text) ;
468
460
}
469
461
}
470
462
} else if right_ctx. status . success && !right_ctx. has_symbol ( ) {
0 commit comments