(&self, frame: &mut Frame, area: Rect)
| 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) |
nothing calls this directly
no test coverage detected