MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / render

Method render

crates/opencode-tui/src/components/prompt.rs:207–364  ·  view source on GitHub ↗
(&self, frame: &mut Frame, area: Rect)

Source from the content-addressed store, hash-verified

205 }
206
207 pub fn render(&self, frame: &mut Frame, area: Rect) {
208 let theme = self.context.theme.read();
209 let agent = self.context.current_agent.read();
210 let model = self.context.current_model.read();
211 let variant = self.context.current_model_variant();
212 let animations_enabled = *self.context.animations_enabled.read();
213
214 let highlight_color = prompt_agent_color(&theme, agent.as_str());
215 let active_color = if matches!(self.mode, PromptMode::Shell) {
216 theme.primary
217 } else {
218 highlight_color
219 };
220 let placeholder = if matches!(self.mode, PromptMode::Shell) {
221 SHELL_PLACEHOLDER
222 } else {
223 self.placeholder.as_str()
224 };
225
226 let max_content_lines = area
227 .height
228 .saturating_sub(3)
229 .saturating_sub(PROMPT_BLOCK_PAD_TOP)
230 .saturating_sub(PROMPT_BLOCK_PAD_BOTTOM)
231 .max(PROMPT_MIN_INPUT_LINES);
232 let content_lines = self.input_display_lines(area.width).min(max_content_lines);
233 let input_lines = content_lines
234 .saturating_add(PROMPT_BLOCK_PAD_TOP)
235 .saturating_add(PROMPT_BLOCK_PAD_BOTTOM);
236 let chunks = Layout::default()
237 .direction(Direction::Vertical)
238 .constraints([
239 Constraint::Length(input_lines),
240 Constraint::Length(1),
241 Constraint::Length(1),
242 Constraint::Length(1),
243 ])
244 .split(area);
245
246 let border_set = ratatui::symbols::border::Set {
247 top_left: " ",
248 top_right: " ",
249 bottom_left: " ",
250 bottom_right: " ",
251 vertical_left: "┃",
252 vertical_right: " ",
253 horizontal_top: " ",
254 horizontal_bottom: " ",
255 };
256
257 let paragraph = if self.input.is_empty() {
258 Paragraph::new(Line::from(Span::styled(
259 placeholder,
260 Style::default().fg(theme.text_muted),
261 )))
262 .block(
263 Block::default()
264 .borders(Borders::LEFT)

Callers

nothing calls this directly

Calls 12

prompt_agent_colorFunction · 0.85
newFunction · 0.85
row_content_areaFunction · 0.85
inset_horizontalFunction · 0.85
readMethod · 0.80
current_model_variantMethod · 0.80
input_display_linesMethod · 0.80
is_emptyMethod · 0.80
render_status_lineMethod · 0.80
as_strMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected