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

Method desired_height

crates/opencode-tui/src/components/toast.rs:101–112  ·  view source on GitHub ↗
(&self, width: u16)

Source from the content-addressed store, hash-verified

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 {

Callers 2

render_mainMethod · 0.45
drawMethod · 0.45

Calls 1

countMethod · 0.80

Tested by

no test coverage detected