MCPcopy Create free account
hub / github.com/GCWing/BitFun / render_field_input

Method render_field_input

src/apps/cli/src/ui/model_config_form.rs:836–1085  ·  view source on GitHub ↗
(
        &self,
        frame: &mut Frame,
        area: Rect,
        field: FormField,
        is_active: bool,
        theme: &Theme,
    )

Source from the content-addressed store, hash-verified

834 }
835
836 fn render_field_input(
837 &self,
838 frame: &mut Frame,
839 area: Rect,
840 field: FormField,
841 is_active: bool,
842 theme: &Theme,
843 ) {
844 match field {
845 // ── Select field ──
846 FormField::ProviderFormat => {
847 let mut spans = vec![Span::styled(" ", Style::default())];
848 for (i, &fmt) in PROVIDER_FORMATS.iter().enumerate() {
849 let selected = i == self.provider_format_index;
850 let style = if selected && is_active {
851 Style::default()
852 .bg(theme.primary)
853 .fg(theme.selection_foreground())
854 .add_modifier(Modifier::BOLD)
855 } else if selected {
856 theme.style(StyleKind::Primary).add_modifier(Modifier::BOLD)
857 } else {
858 theme.style(StyleKind::Muted)
859 };
860 let label = if selected {
861 format!(" [{}] ", fmt)
862 } else {
863 format!(" {} ", fmt)
864 };
865 spans.push(Span::styled(label, style));
866 }
867 if is_active {
868 spans.push(Span::styled(
869 " \u{2190}\u{2192} to change",
870 theme.style(StyleKind::Muted),
871 ));
872 }
873 frame.render_widget(Paragraph::new(Line::from(spans)), area);
874 }
875
876 // ── Select field: Custom Headers Mode ──
877 FormField::CustomHeadersMode => {
878 let mut spans = vec![Span::styled(" ", Style::default())];
879 for (i, &mode) in CUSTOM_HEADERS_MODES.iter().enumerate() {
880 let selected = i == self.custom_headers_mode_index;
881 let style = if selected && is_active {
882 Style::default()
883 .bg(theme.primary)
884 .fg(theme.selection_foreground())
885 .add_modifier(Modifier::BOLD)
886 } else if selected {
887 theme.style(StyleKind::Primary).add_modifier(Modifier::BOLD)
888 } else {
889 theme.style(StyleKind::Muted)
890 };
891 let label = if selected {
892 format!(" [{}] ", mode)
893 } else {

Callers 1

renderMethod · 0.80

Calls 12

iterMethod · 0.80
selection_foregroundMethod · 0.80
styleMethod · 0.80
takeMethod · 0.80
nextMethod · 0.80
field_placeholderMethod · 0.80
trimMethod · 0.80
char_to_byteFunction · 0.70
pushMethod · 0.45
is_emptyMethod · 0.45
countMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected