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

Method render_main

src/apps/cli/src/ui/startup.rs:472–518  ·  view source on GitHub ↗

Render main content, returns the input box area (for command menu positioning)

(&mut self, frame: &mut Frame, area: Rect)

Source from the content-addressed store, hash-verified

470
471 /// Render main content, returns the input box area (for command menu positioning)
472 fn render_main(&mut self, frame: &mut Frame, area: Rect) -> Rect {
473 let max_width = 75u16.min(area.width.saturating_sub(4));
474
475 // Dynamic input height: content lines (1..6) + 2 (padding top + agent label row) + 1 (gap)
476 let input_content_width = max_width.saturating_sub(2 + 4); // left bar(2) + inner padding(4)
477 let visual_lines =
478 self.text_input
479 .visual_line_count_with_prefix(input_content_width, 0) as u16;
480 let content_lines = visual_lines.max(1).min(6);
481 let input_box_height = content_lines + 3; // +1 top padding, +1 gap, +1 agent label
482
483 let v_chunks = Layout::default()
484 .direction(Direction::Vertical)
485 .constraints([
486 Constraint::Percentage(20), // top space
487 Constraint::Length(12), // logo
488 Constraint::Length(1), // gap
489 Constraint::Length(input_box_height), // input box
490 Constraint::Length(2), // gap + tip/status
491 Constraint::Min(1), // bottom space
492 ])
493 .split(area);
494
495 // Logo
496 self.render_logo(frame, v_chunks[1]);
497
498 // Input box - centered horizontally
499 let h_pad = area.width.saturating_sub(max_width) / 2;
500 let input_area = Rect {
501 x: area.x + h_pad,
502 y: v_chunks[3].y,
503 width: max_width,
504 height: v_chunks[3].height,
505 };
506 self.render_input(frame, input_area);
507
508 // Tip / status
509 let tip_area = Rect {
510 x: area.x + h_pad,
511 y: v_chunks[4].y + 1,
512 width: max_width,
513 height: 1,
514 };
515 self.render_tip_or_status(frame, tip_area);
516
517 input_area
518 }
519
520 fn render_input(&mut self, frame: &mut Frame, area: Rect) {
521 let highlight_color = self.theme.primary;

Callers 1

renderMethod · 0.80

Calls 4

render_logoMethod · 0.80
render_tip_or_statusMethod · 0.80
render_inputMethod · 0.45

Tested by

no test coverage detected