tenseleyflow/fackr / 424dab2

Browse files

fix: fuss mode and terminal coexist properly

- F3/Ctrl+B now toggles fuss mode even when terminal is focused
- Terminal shrinks to fit alongside fuss mode instead of overlapping
- Pass left_offset to render_terminal for proper positioning
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
424dab2e4c3da85832c0bbcbd14875aa51d60a8c
Parents
228cfd5
Tree
870a4cc

2 changed files

StatusFile+-
M src/editor/state.rs 1 1
M src/render/screen.rs 11 10
src/editor/state.rsmodified
@@ -1840,7 +1840,7 @@ impl Editor {
18401840
 
18411841
             // Render terminal panel if visible (overlays editor content)
18421842
             if self.terminal.visible {
1843
-                self.screen.render_terminal(&self.terminal)?;
1843
+                self.screen.render_terminal(&self.terminal, fuss_width)?;
18441844
             }
18451845
 
18461846
             // Render rename modal if active
src/render/screen.rsmodified
@@ -3734,17 +3734,18 @@ impl Screen {
37343734
     }
37353735
 
37363736
     /// 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<()> {
37383738
         // Hide cursor during render to prevent flicker
37393739
         execute!(self.stdout, Hide)?;
37403740
 
37413741
         let start_row = terminal.render_start_row(self.rows);
37423742
         let height = terminal.height;
3743
+        let terminal_width = self.cols.saturating_sub(left_offset) as usize;
37433744
 
37443745
         // Draw terminal border (top line with title)
37453746
         execute!(
37463747
             self.stdout,
3747
-            MoveTo(0, start_row),
3748
+            MoveTo(left_offset, start_row),
37483749
             SetBackgroundColor(Color::AnsiValue(237)),
37493750
             SetForegroundColor(Color::White),
37503751
         )?;
@@ -3759,7 +3760,7 @@ impl Screen {
37593760
                 .map(|p| extract_dirname(p))
37603761
                 .unwrap_or_else(|| "Terminal".to_string());
37613762
             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);
37633764
             execute!(
37643765
                 self.stdout,
37653766
                 Print(&separator),
@@ -3773,13 +3774,13 @@ impl Screen {
37733774
 
37743775
             // Pad to end of line
37753776
             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)))?;
37783779
             }
37793780
         } else {
37803781
             // Multiple sessions: render tab bar
37813782
             let sessions = terminal.sessions();
3782
-            let available_width = self.cols as usize;
3783
+            let available_width = terminal_width;
37833784
             let tab_width = (available_width / session_count).max(8).min(25);
37843785
 
37853786
             let mut printed = 0;
@@ -3872,7 +3873,7 @@ impl Screen {
38723873
         )?;
38733874
 
38743875
         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))?;
38763877
 
38773878
             // Build a string of characters with same attributes to batch print
38783879
             let mut batch = String::new();
@@ -3881,7 +3882,7 @@ impl Screen {
38813882
             let mut batch_bold = current_bold;
38823883
             let mut batch_underline = current_underline;
38833884
 
3884
-            for col in 0..self.cols as usize {
3885
+            for col in 0..terminal_width {
38853886
                 let (c, fg, bg, bold, underline) = if let Some(cell) = terminal.get_cell(row as usize, col) {
38863887
                     let (fg, bg) = if cell.inverse {
38873888
                         let fg = TerminalPanel::to_crossterm_color(&cell.bg);
@@ -3973,10 +3974,10 @@ impl Screen {
39733974
             }
39743975
         }
39753976
 
3976
-        // Position cursor in terminal
3977
+        // Position cursor in terminal (offset by left_offset)
39773978
         execute!(
39783979
             self.stdout,
3979
-            MoveTo(cursor_col, start_row + 1 + cursor_row),
3980
+            MoveTo(left_offset + cursor_col, start_row + 1 + cursor_row),
39803981
             Show,
39813982
             ResetColor
39823983
         )?;