MCPcopy Index your code
hub / github.com/encounter/objdiff / context_menu_items_ui

Function context_menu_items_ui

objdiff-gui/src/views/diff.rs:954–1003  ·  view source on GitHub ↗
(
    ui: &mut Ui,
    items: Vec<ContextItem>,
    column: usize,
    appearance: &Appearance,
)

Source from the content-addressed store, hash-verified

952}
953
954pub fn context_menu_items_ui(
955 ui: &mut Ui,
956 items: Vec<ContextItem>,
957 column: usize,
958 appearance: &Appearance,
959) -> Option<DiffViewAction> {
960 let mut ret = None;
961 for item in items {
962 match item {
963 ContextItem::Copy { value, label, copy_string } => {
964 let mut job = LayoutJob::default();
965 write_text("Copy ", appearance.text_color, &mut job, appearance.code_font.clone());
966 write_text(
967 &format!("{value:?}"),
968 appearance.highlight_color,
969 &mut job,
970 appearance.code_font.clone(),
971 );
972 if let Some(label) = label {
973 write_text(" (", appearance.text_color, &mut job, appearance.code_font.clone());
974 write_text(
975 &label,
976 appearance.text_color,
977 &mut job,
978 appearance.code_font.clone(),
979 );
980 write_text(")", appearance.text_color, &mut job, appearance.code_font.clone());
981 }
982 if ui.button(job).clicked() {
983 ui.ctx().copy_text(copy_string.unwrap_or(value));
984 ui.close();
985 }
986 }
987 ContextItem::Navigate { label, symbol_index, kind } => {
988 if ui.button(label).clicked() {
989 ret = Some(DiffViewAction::Navigate(DiffViewNavigation::new(
990 kind,
991 symbol_index,
992 column,
993 )));
994 ui.close();
995 }
996 }
997 ContextItem::Separator => {
998 ui.separator();
999 }
1000 }
1001 }
1002 ret
1003}

Callers 3

symbol_context_menu_uiFunction · 0.85
ins_context_menuFunction · 0.85
data_row_context_menuFunction · 0.85

Calls 2

write_textFunction · 0.85
separatorMethod · 0.45

Tested by

no test coverage detected