(&self, width: u16)
| 99 | } |
| 100 | |
| 101 | pub fn desired_height(&self, width: u16) -> u16 { |
| 102 | let Some(msg) = self.message.as_ref() else { |
| 103 | return 0; |
| 104 | }; |
| 105 | if width == 0 { |
| 106 | return 0; |
| 107 | } |
| 108 | let text_width = usize::from(width.saturating_sub(4)).max(1); |
| 109 | let lines = msg.chars().count().div_ceil(text_width).max(1) as u16; |
| 110 | // 2 for vertical padding/border room. |
| 111 | (lines + 2).clamp(3, 6) |
| 112 | } |
| 113 | |
| 114 | pub fn render(&self, frame: &mut Frame, area: Rect, theme: &Theme) { |
| 115 | if let Some(msg) = &self.message { |
no test coverage detected