@@ -3734,17 +3734,18 @@ impl Screen { |
| 3734 | 3734 | } |
| 3735 | 3735 | |
| 3736 | 3736 | /// Render the integrated terminal panel |
| 3737 | | - pub fn render_terminal(&mut self, terminal: &TerminalPanel) -> Result<()> { |
| 3737 | + pub fn render_terminal(&mut self, terminal: &TerminalPanel, left_offset: u16) -> Result<()> { |
| 3738 | 3738 | // Hide cursor during render to prevent flicker |
| 3739 | 3739 | execute!(self.stdout, Hide)?; |
| 3740 | 3740 | |
| 3741 | 3741 | let start_row = terminal.render_start_row(self.rows); |
| 3742 | 3742 | let height = terminal.height; |
| 3743 | + let terminal_width = self.cols.saturating_sub(left_offset) as usize; |
| 3743 | 3744 | |
| 3744 | 3745 | // Draw terminal border (top line with title) |
| 3745 | 3746 | execute!( |
| 3746 | 3747 | self.stdout, |
| 3747 | | - MoveTo(0, start_row), |
| 3748 | + MoveTo(left_offset, start_row), |
| 3748 | 3749 | SetBackgroundColor(Color::AnsiValue(237)), |
| 3749 | 3750 | SetForegroundColor(Color::White), |
| 3750 | 3751 | )?; |
@@ -3759,7 +3760,7 @@ impl Screen { |
| 3759 | 3760 | .map(|p| extract_dirname(p)) |
| 3760 | 3761 | .unwrap_or_else(|| "Terminal".to_string()); |
| 3761 | 3762 | let title = format!(" {} ", name); |
| 3762 | | - let separator = "─".repeat((self.cols as usize).saturating_sub(title.len() + 2) / 2); |
| 3763 | + let separator = "─".repeat(terminal_width.saturating_sub(title.len() + 2) / 2); |
| 3763 | 3764 | execute!( |
| 3764 | 3765 | self.stdout, |
| 3765 | 3766 | Print(&separator), |
@@ -3773,13 +3774,13 @@ impl Screen { |
| 3773 | 3774 | |
| 3774 | 3775 | // Pad to end of line |
| 3775 | 3776 | let printed = separator.chars().count() * 2 + title.len(); |
| 3776 | | - if printed < self.cols as usize { |
| 3777 | | - execute!(self.stdout, Print(" ".repeat(self.cols as usize - printed)))?; |
| 3777 | + if printed < terminal_width { |
| 3778 | + execute!(self.stdout, Print(" ".repeat(terminal_width - printed)))?; |
| 3778 | 3779 | } |
| 3779 | 3780 | } else { |
| 3780 | 3781 | // Multiple sessions: render tab bar |
| 3781 | 3782 | let sessions = terminal.sessions(); |
| 3782 | | - let available_width = self.cols as usize; |
| 3783 | + let available_width = terminal_width; |
| 3783 | 3784 | let tab_width = (available_width / session_count).max(8).min(25); |
| 3784 | 3785 | |
| 3785 | 3786 | let mut printed = 0; |
@@ -3872,7 +3873,7 @@ impl Screen { |
| 3872 | 3873 | )?; |
| 3873 | 3874 | |
| 3874 | 3875 | for row in 0..(height - 1) { |
| 3875 | | - execute!(self.stdout, MoveTo(0, start_row + 1 + row))?; |
| 3876 | + execute!(self.stdout, MoveTo(left_offset, start_row + 1 + row))?; |
| 3876 | 3877 | |
| 3877 | 3878 | // Build a string of characters with same attributes to batch print |
| 3878 | 3879 | let mut batch = String::new(); |
@@ -3881,7 +3882,7 @@ impl Screen { |
| 3881 | 3882 | let mut batch_bold = current_bold; |
| 3882 | 3883 | let mut batch_underline = current_underline; |
| 3883 | 3884 | |
| 3884 | | - for col in 0..self.cols as usize { |
| 3885 | + for col in 0..terminal_width { |
| 3885 | 3886 | let (c, fg, bg, bold, underline) = if let Some(cell) = terminal.get_cell(row as usize, col) { |
| 3886 | 3887 | let (fg, bg) = if cell.inverse { |
| 3887 | 3888 | let fg = TerminalPanel::to_crossterm_color(&cell.bg); |
@@ -3973,10 +3974,10 @@ impl Screen { |
| 3973 | 3974 | } |
| 3974 | 3975 | } |
| 3975 | 3976 | |
| 3976 | | - // Position cursor in terminal |
| 3977 | + // Position cursor in terminal (offset by left_offset) |
| 3977 | 3978 | execute!( |
| 3978 | 3979 | self.stdout, |
| 3979 | | - MoveTo(cursor_col, start_row + 1 + cursor_row), |
| 3980 | + MoveTo(left_offset + cursor_col, start_row + 1 + cursor_row), |
| 3980 | 3981 | Show, |
| 3981 | 3982 | ResetColor |
| 3982 | 3983 | )?; |