MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / render

Method render

crates/opencode-tui/src/components/thinking.rs:51–104  ·  view source on GitHub ↗
(&self, frame: &mut Frame, area: Rect, theme: &Theme)

Source from the content-addressed store, hash-verified

49 }
50
51 pub fn render(&self, frame: &mut Frame, area: Rect, theme: &Theme) {
52 if !self.visible {
53 return;
54 }
55
56 let title = if let Some(ms) = self.duration_ms {
57 if ms < 1000 {
58 format!("Thinking... ({}ms)", ms)
59 } else {
60 format!("Thinking... ({:.1}s)", ms as f64 / 1000.0)
61 }
62 } else {
63 "Thinking...".to_string()
64 };
65
66 let expand_icon = if self.collapsed { "▶" } else { "▼" };
67
68 let lines = if self.collapsed {
69 vec![Line::from(vec![
70 Span::styled(expand_icon, Style::default().fg(theme.primary)),
71 Span::raw(" "),
72 Span::styled(title, Style::default().fg(theme.text_muted)),
73 ])]
74 } else {
75 let mut lines = vec![Line::from(vec![
76 Span::styled(expand_icon, Style::default().fg(theme.primary)),
77 Span::raw(" "),
78 Span::styled(
79 title,
80 Style::default()
81 .fg(theme.primary)
82 .add_modifier(Modifier::BOLD),
83 ),
84 ])];
85
86 lines.push(Line::from(""));
87 // Show full content when expanded (no 10-line limit)
88 for line in self.content.lines() {
89 lines.push(Line::from(Span::styled(
90 line.to_string(),
91 Style::default().fg(theme.text_muted),
92 )));
93 }
94 lines
95 };
96
97 let paragraph = Paragraph::new(lines).block(
98 Block::default()
99 .borders(Borders::LEFT)
100 .border_style(Style::default().fg(theme.info)),
101 );
102
103 frame.render_widget(paragraph, area);
104 }
105}

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected