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

Function symbol_list_ui

objdiff-gui/src/views/symbol_diff.rs:696–839  ·  view source on GitHub ↗
(
    ui: &mut Ui,
    ctx: SymbolDiffContext<'_>,
    state: &SymbolViewState,
    filter: SymbolFilter<'_>,
    appearance: &Appearance,
    column: usize,
    open_sections: Option<bool>,
    diff_

Source from the content-addressed store, hash-verified

694
695#[must_use]
696pub fn symbol_list_ui(
697 ui: &mut Ui,
698 ctx: SymbolDiffContext<'_>,
699 state: &SymbolViewState,
700 filter: SymbolFilter<'_>,
701 appearance: &Appearance,
702 column: usize,
703 open_sections: Option<bool>,
704 diff_config: &DiffObjConfig,
705) -> Option<DiffViewAction> {
706 let mut ret = None;
707 ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
708 let mut show_mapped_symbols = state.show_mapped_symbols;
709 if let SymbolFilter::Mapping(_, _) = filter
710 && ui.checkbox(&mut show_mapped_symbols, "Show mapped symbols").changed()
711 {
712 ret = Some(DiffViewAction::SetShowMappedSymbols(show_mapped_symbols));
713 }
714 let section_display = display_sections(
715 ctx.obj,
716 ctx.diff,
717 filter,
718 state.show_hidden_symbols,
719 show_mapped_symbols,
720 state.reverse_fn_order,
721 );
722
723 hotkeys::check_scroll_hotkeys(ui, false);
724
725 let mut new_key_value_to_highlight = None;
726 if let Some(sym_ref) =
727 if column == 0 { state.highlighted_symbol.0 } else { state.highlighted_symbol.1 }
728 {
729 let up = if hotkeys::consume_up_key(ui.ctx()) {
730 Some(true)
731 } else if hotkeys::consume_down_key(ui.ctx()) {
732 Some(false)
733 } else {
734 None
735 };
736 if let Some(up) = up {
737 new_key_value_to_highlight = if up {
738 find_prev_symbol(&section_display, sym_ref)
739 } else {
740 find_next_symbol(&section_display, sym_ref)
741 };
742 };
743 } else {
744 // No symbol is highlighted in this column. Select the topmost symbol instead.
745 // Note that we intentionally do not consume the up/down key presses in this case, but
746 // we do when a symbol is highlighted. This is so that if only one column has a symbol
747 // highlighted, that one takes precedence over the one with nothing highlighted.
748 if hotkeys::up_pressed(ui.ctx()) || hotkeys::down_pressed(ui.ctx()) {
749 new_key_value_to_highlight = find_first_symbol(&section_display);
750 }
751 }
752 if let Some(new_sym_ref) = new_key_value_to_highlight {
753 let target_symbol = ctx.diff.symbols[new_sym_ref].target_symbol;

Callers 1

diff_col_uiFunction · 0.85

Calls 13

display_sectionsFunction · 0.85
check_scroll_hotkeysFunction · 0.85
consume_up_keyFunction · 0.85
consume_down_keyFunction · 0.85
find_prev_symbolFunction · 0.85
find_next_symbolFunction · 0.85
up_pressedFunction · 0.85
down_pressedFunction · 0.85
find_first_symbolFunction · 0.85
write_textFunction · 0.85
match_color_for_symbolFunction · 0.85
symbol_uiFunction · 0.85

Tested by

no test coverage detected