@@ -34,9 +34,11 @@ impl TerminalPanel { |
| 34 | 34 | /// Create a new terminal panel (not yet spawned) |
| 35 | 35 | pub fn new(screen_width: u16, screen_height: u16) -> Self { |
| 36 | 36 | let height = (screen_height * DEFAULT_HEIGHT_PERCENT / 100).max(MIN_HEIGHT_ROWS); |
| 37 | + // Content area is height - 1 (title bar takes one row) |
| 38 | + let content_height = height.saturating_sub(1).max(1); |
| 37 | 39 | Self { |
| 38 | 40 | pty: None, |
| 39 | | - screen: TerminalScreen::new(screen_width, height), |
| 41 | + screen: TerminalScreen::new(screen_width, content_height), |
| 40 | 42 | visible: false, |
| 41 | 43 | height, |
| 42 | 44 | screen_height, |
@@ -58,7 +60,9 @@ impl TerminalPanel { |
| 58 | 60 | |
| 59 | 61 | /// Spawn the PTY process |
| 60 | 62 | fn spawn(&mut self) -> Result<()> { |
| 61 | | - let pty = Pty::spawn(self.screen_width, self.height)?; |
| 63 | + // PTY gets content height (excluding title bar) |
| 64 | + let content_height = self.height.saturating_sub(1).max(1); |
| 65 | + let pty = Pty::spawn(self.screen_width, content_height)?; |
| 62 | 66 | self.pty = Some(pty); |
| 63 | 67 | Ok(()) |
| 64 | 68 | } |
@@ -177,12 +181,15 @@ impl TerminalPanel { |
| 177 | 181 | let max_height = height * MAX_HEIGHT_PERCENT / 100; |
| 178 | 182 | self.height = self.height.min(max_height).max(MIN_HEIGHT_ROWS); |
| 179 | 183 | |
| 184 | + // Content height excludes title bar |
| 185 | + let content_height = self.height.saturating_sub(1).max(1); |
| 186 | + |
| 180 | 187 | // Resize terminal screen |
| 181 | | - self.screen.resize(width, self.height); |
| 188 | + self.screen.resize(width, content_height); |
| 182 | 189 | |
| 183 | 190 | // Resize PTY |
| 184 | 191 | if let Some(ref pty) = self.pty { |
| 185 | | - let _ = pty.resize(width, self.height); |
| 192 | + let _ = pty.resize(width, content_height); |
| 186 | 193 | } |
| 187 | 194 | } |
| 188 | 195 | |
@@ -191,10 +198,13 @@ impl TerminalPanel { |
| 191 | 198 | let max_height = self.screen_height * MAX_HEIGHT_PERCENT / 100; |
| 192 | 199 | self.height = new_height.min(max_height).max(MIN_HEIGHT_ROWS); |
| 193 | 200 | |
| 194 | | - self.screen.resize(self.screen_width, self.height); |
| 201 | + // Content height excludes title bar |
| 202 | + let content_height = self.height.saturating_sub(1).max(1); |
| 203 | + |
| 204 | + self.screen.resize(self.screen_width, content_height); |
| 195 | 205 | |
| 196 | 206 | if let Some(ref pty) = self.pty { |
| 197 | | - let _ = pty.resize(self.screen_width, self.height); |
| 207 | + let _ = pty.resize(self.screen_width, content_height); |
| 198 | 208 | } |
| 199 | 209 | } |
| 200 | 210 | |