tenseleyflow/fackr / 1018a92

Browse files

Reduce cursor flicker by batching terminal writes

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
1018a92721d8cc22909e4248c4a7e54f4630ef2f
Parents
88396f7
Tree
5336455

2 changed files

StatusFile+-
M src/editor/state.rs 3 0
M src/render/screen.rs 273 286
src/editor/state.rsmodified
@@ -1971,6 +1971,9 @@ impl Editor {
19711971
     }
19721972
 
19731973
     fn render(&mut self) -> Result<()> {
1974
+        // Hide cursor at start of render pass to prevent flicker
1975
+        self.screen.hide_cursor()?;
1976
+
19741977
         // Calculate fuss pane width if active
19751978
         let fuss_width = if self.workspace.fuss.active {
19761979
             self.workspace.fuss.width(self.screen.cols)
src/render/screen.rsmodified
1971 lines changed — click to load
@@ -5,7 +5,7 @@ use crossterm::{
55
         DisableMouseCapture, EnableMouseCapture,
66
         KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags,
77
     },
8
-    execute,
8
+    execute, queue,
99
     style::{Attribute, Color, Print, ResetColor, SetAttribute, SetBackgroundColor, SetForegroundColor},
1010
     terminal::{self, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen},
1111
 };
@@ -153,25 +153,31 @@ impl Screen {
153153
 
154154
     /// Position and show the hardware cursor at the given screen coordinates
155155
     pub fn show_cursor_at(&mut self, col: u16, row: u16) -> Result<()> {
156
-        execute!(self.stdout, MoveTo(col, row), Show)?;
156
+        queue!(self.stdout, MoveTo(col, row), Show)?;
157157
         self.stdout.flush()?;
158158
         Ok(())
159159
     }
160160
 
161
+    /// Hide the hardware cursor (call at start of render pass)
162
+    pub fn hide_cursor(&mut self) -> Result<()> {
163
+        queue!(self.stdout, Hide)?;
164
+        Ok(())
165
+    }
166
+
161167
     #[allow(dead_code)]
162168
     pub fn clear(&mut self) -> Result<()> {
163
-        execute!(self.stdout, Clear(ClearType::All))?;
169
+        queue!(self.stdout, Clear(ClearType::All))?;
164170
         Ok(())
165171
     }
166172
 
167173
     /// Render the tab bar
168174
     /// Returns the height of the tab bar (always 1)
169175
     pub fn render_tab_bar(&mut self, tabs: &[TabInfo], left_offset: u16) -> Result<u16> {
170
-        execute!(self.stdout, MoveTo(left_offset, 0))?;
176
+        queue!(self.stdout, MoveTo(left_offset, 0))?;
171177
 
172178
         // Fill the tab bar background
173179
         let available_width = self.cols.saturating_sub(left_offset) as usize;
174
-        execute!(
180
+        queue!(
175181
             self.stdout,
176182
             SetBackgroundColor(TAB_BAR_BG),
177183
             SetForegroundColor(TAB_INACTIVE_FG),
@@ -214,7 +220,7 @@ impl Screen {
214220
                 (TAB_BAR_BG, TAB_INACTIVE_FG)
215221
             };
216222
 
217
-            execute!(
223
+            queue!(
218224
                 self.stdout,
219225
                 MoveTo(current_col as u16, 0),
220226
                 SetBackgroundColor(bg),
@@ -222,7 +228,7 @@ impl Screen {
222228
 
223229
             // Print index number (for Alt+N shortcut hint)
224230
             if !index_str.is_empty() {
225
-                execute!(
231
+                queue!(
226232
                     self.stdout,
227233
                     SetForegroundColor(LINE_NUM_COLOR),
228234
                     Print(&index_str),
@@ -231,7 +237,7 @@ impl Screen {
231237
             }
232238
 
233239
             // Print tab name
234
-            execute!(
240
+            queue!(
235241
                 self.stdout,
236242
                 SetForegroundColor(fg),
237243
                 Print(&display_name),
@@ -239,7 +245,7 @@ impl Screen {
239245
 
240246
             // Print modified indicator
241247
             if tab.is_modified {
242
-                execute!(
248
+                queue!(
243249
                     self.stdout,
244250
                     SetForegroundColor(TAB_MODIFIED_FG),
245251
                     Print(modified_str),
@@ -250,7 +256,7 @@ impl Screen {
250256
 
251257
             // Add separator between tabs
252258
             if i + 1 < tab_count {
253
-                execute!(
259
+                queue!(
254260
                     self.stdout,
255261
                     SetBackgroundColor(TAB_BAR_BG),
256262
                     SetForegroundColor(LINE_NUM_COLOR),
@@ -261,7 +267,7 @@ impl Screen {
261267
         }
262268
 
263269
         // Fill the rest of the line
264
-        execute!(
270
+        queue!(
265271
             self.stdout,
266272
             SetBackgroundColor(TAB_BAR_BG),
267273
             Clear(ClearType::UntilNewLine),
@@ -281,8 +287,6 @@ impl Screen {
281287
         left_offset: u16,
282288
         top_offset: u16,
283289
     ) -> Result<()> {
284
-        execute!(self.stdout, Hide)?;
285
-
286290
         // Calculate available screen area
287291
         let available_width = self.cols.saturating_sub(left_offset) as f32;
288292
         let available_height = self.rows.saturating_sub(2 + top_offset) as f32; // -2 for gap + status bar
@@ -316,7 +320,7 @@ impl Screen {
316320
                 let sep_x = pane_x.saturating_sub(1);
317321
                 let sep_color = if pane.is_active { PANE_ACTIVE_SEPARATOR_FG } else { PANE_SEPARATOR_FG };
318322
                 for row in 0..pane_height {
319
-                    execute!(
323
+                    queue!(
320324
                         self.stdout,
321325
                         MoveTo(sep_x, pane_y + row),
322326
                         SetBackgroundColor(BG_COLOR),
@@ -331,7 +335,7 @@ impl Screen {
331335
                 let sep_y = pane_y.saturating_sub(1);
332336
                 let sep_color = if pane.is_active { PANE_ACTIVE_SEPARATOR_FG } else { PANE_SEPARATOR_FG };
333337
                 for col in 0..pane_width {
334
-                    execute!(
338
+                    queue!(
335339
                         self.stdout,
336340
                         MoveTo(pane_x + col, sep_y),
337341
                         SetBackgroundColor(BG_COLOR),
@@ -344,7 +348,7 @@ impl Screen {
344348
 
345349
         // Render the gap row (empty line between text and status bar)
346350
         let gap_row = top_offset + available_height as u16;
347
-        execute!(
351
+        queue!(
348352
             self.stdout,
349353
             MoveTo(left_offset, gap_row),
350354
             SetBackgroundColor(BG_COLOR),
@@ -363,12 +367,11 @@ impl Screen {
363367
             )?;
364368
         }
365369
 
366
-        // Position hardware cursor
370
+        // Position hardware cursor (but don't show - caller handles that)
367371
         if let Some((col, row)) = cursor_screen_pos {
368
-            execute!(self.stdout, MoveTo(col, row), Show)?;
372
+            queue!(self.stdout, MoveTo(col, row))?;
369373
         }
370374
 
371
-        self.stdout.flush()?;
372375
         Ok(())
373376
     }
374377
 
@@ -423,7 +426,7 @@ impl Screen {
423426
         for row in 0..height as usize {
424427
             let line_idx = pane.viewport_line + row;
425428
             let is_current_line = line_idx == primary.line;
426
-            execute!(self.stdout, MoveTo(x, y + row as u16))?;
429
+            queue!(self.stdout, MoveTo(x, y + row as u16))?;
427430
 
428431
             if line_idx < buffer.line_count() {
429432
                 let line_num_fg = if is_current_line {
@@ -433,7 +436,7 @@ impl Screen {
433436
                 };
434437
                 let line_bg = if is_current_line { current_line_bg } else { bg_color };
435438
 
436
-                execute!(
439
+                queue!(
437440
                     self.stdout,
438441
                     SetBackgroundColor(line_bg),
439442
                     SetForegroundColor(line_num_fg),
@@ -464,7 +467,7 @@ impl Screen {
464467
                     } else {
465468
                         // Inactive pane: simple dimmed text
466469
                         let chars: String = line.chars().take(text_cols).collect();
467
-                        execute!(
470
+                        queue!(
468471
                             self.stdout,
469472
                             SetBackgroundColor(line_bg),
470473
                             SetForegroundColor(text_color),
@@ -474,7 +477,7 @@ impl Screen {
474477
                 }
475478
 
476479
                 // Fill rest of pane width
477
-                execute!(
480
+                queue!(
478481
                     self.stdout,
479482
                     SetBackgroundColor(line_bg),
480483
                 )?;
@@ -482,11 +485,11 @@ impl Screen {
482485
                 let current_col = x + line_num_width as u16 + 1 + text_cols.min(line_len) as u16;
483486
                 let remaining = (x + width).saturating_sub(current_col);
484487
                 if remaining > 0 {
485
-                    execute!(self.stdout, Print(" ".repeat(remaining as usize)))?;
488
+                    queue!(self.stdout, Print(" ".repeat(remaining as usize)))?;
486489
                 }
487
-                execute!(self.stdout, ResetColor)?;
490
+                queue!(self.stdout, ResetColor)?;
488491
             } else {
489
-                execute!(
492
+                queue!(
490493
                     self.stdout,
491494
                     SetBackgroundColor(bg_color),
492495
                     SetForegroundColor(if is_active { Color::DarkBlue } else { INACTIVE_LINE_NUM_COLOR }),
@@ -494,7 +497,7 @@ impl Screen {
494497
                 )?;
495498
                 // Fill rest of line within pane bounds
496499
                 let remaining = width.saturating_sub(line_num_width as u16 + 1);
497
-                execute!(self.stdout, Print(" ".repeat(remaining as usize)), ResetColor)?;
500
+                queue!(self.stdout, Print(" ".repeat(remaining as usize)), ResetColor)?;
498501
             }
499502
         }
500503
 
@@ -545,9 +548,6 @@ impl Screen {
545548
         message: Option<&str>,
546549
         bracket_match: Option<(usize, usize)>,
547550
     ) -> Result<()> {
548
-        // Hide cursor during render to prevent flicker
549
-        execute!(self.stdout, Hide)?;
550
-
551551
         let line_num_width = self.line_number_width(buffer.line_count());
552552
         let text_cols = self.cols as usize - line_num_width - 1;
553553
 
@@ -575,7 +575,7 @@ impl Screen {
575575
         for row in 0..text_rows {
576576
             let line_idx = viewport_line + row;
577577
             let is_current_line = line_idx == primary.line;
578
-            execute!(self.stdout, MoveTo(0, row as u16))?;
578
+            queue!(self.stdout, MoveTo(0, row as u16))?;
579579
 
580580
             if line_idx < buffer.line_count() {
581581
                 // Line number with appropriate color
@@ -586,7 +586,7 @@ impl Screen {
586586
                 };
587587
                 let line_bg = if is_current_line { CURRENT_LINE_BG } else { BG_COLOR };
588588
 
589
-                execute!(
589
+                queue!(
590590
                     self.stdout,
591591
                     SetBackgroundColor(line_bg),
592592
                     SetForegroundColor(line_num_fg),
@@ -618,7 +618,7 @@ impl Screen {
618618
                 }
619619
 
620620
                 // Fill rest of line with background color
621
-                execute!(
621
+                queue!(
622622
                     self.stdout,
623623
                     SetBackgroundColor(line_bg),
624624
                     Clear(ClearType::UntilNewLine),
@@ -626,7 +626,7 @@ impl Screen {
626626
                 )?;
627627
             } else {
628628
                 // Empty line indicator
629
-                execute!(
629
+                queue!(
630630
                     self.stdout,
631631
                     SetBackgroundColor(BG_COLOR),
632632
                     SetForegroundColor(Color::DarkBlue),
@@ -639,7 +639,7 @@ impl Screen {
639639
 
640640
         // Render the gap row (empty line between text and status bar)
641641
         let gap_row = text_rows as u16;
642
-        execute!(
642
+        queue!(
643643
             self.stdout,
644644
             MoveTo(0, gap_row),
645645
             SetBackgroundColor(BG_COLOR),
@@ -650,16 +650,14 @@ impl Screen {
650650
         // Status bar
651651
         self.render_status_bar(buffer, cursors, filename, message)?;
652652
 
653
-        // Position hardware cursor at primary cursor
653
+        // Position hardware cursor at primary cursor (but don't show - caller handles that)
654654
         let cursor_row = primary.line.saturating_sub(viewport_line);
655655
         let cursor_col = line_num_width + 1 + primary.col;
656
-        execute!(
656
+        queue!(
657657
             self.stdout,
658658
             MoveTo(cursor_col as u16, cursor_row as u16),
659
-            Show
660659
         )?;
661660
 
662
-        self.stdout.flush()?;
663661
         Ok(())
664662
     }
665663
 
@@ -774,7 +772,7 @@ impl Screen {
774772
 
775773
             // Apply styling
776774
             if bold {
777
-                execute!(
775
+                queue!(
778776
                     self.stdout,
779777
                     SetBackgroundColor(bg),
780778
                     SetForegroundColor(fg),
@@ -783,7 +781,7 @@ impl Screen {
783781
                     SetAttribute(Attribute::NoBold),
784782
                 )?;
785783
             } else {
786
-                execute!(
784
+                queue!(
787785
                     self.stdout,
788786
                     SetBackgroundColor(bg),
789787
                     SetForegroundColor(fg),
@@ -793,7 +791,7 @@ impl Screen {
793791
         }
794792
 
795793
         // Reset to line background for rest of line
796
-        execute!(self.stdout, SetBackgroundColor(line_bg), SetForegroundColor(default_fg))?;
794
+        queue!(self.stdout, SetBackgroundColor(line_bg), SetForegroundColor(default_fg))?;
797795
 
798796
         // Handle secondary cursors at end of line (past text content)
799797
         let max_cursor_past_text = secondary_cursors.iter()
@@ -805,21 +803,21 @@ impl Screen {
805803
             if max_cursor < max_cols {
806804
                 for col in char_count..=max_cursor {
807805
                     if secondary_cursors.contains(&col) {
808
-                        execute!(
806
+                        queue!(
809807
                             self.stdout,
810808
                             SetBackgroundColor(Color::Magenta),
811809
                             SetForegroundColor(Color::White),
812810
                             Print(" ")
813811
                         )?;
814812
                     } else {
815
-                        execute!(
813
+                        queue!(
816814
                             self.stdout,
817815
                             SetBackgroundColor(line_bg),
818816
                             Print(" ")
819817
                         )?;
820818
                     }
821819
                 }
822
-                execute!(self.stdout, SetBackgroundColor(line_bg), SetForegroundColor(default_fg))?;
820
+                queue!(self.stdout, SetBackgroundColor(line_bg), SetForegroundColor(default_fg))?;
823821
             }
824822
         }
825823
 
@@ -835,10 +833,10 @@ impl Screen {
835833
         message: Option<&str>,
836834
     ) -> Result<()> {
837835
         let status_row = self.rows.saturating_sub(1);
838
-        execute!(self.stdout, MoveTo(0, status_row))?;
836
+        queue!(self.stdout, MoveTo(0, status_row))?;
839837
 
840838
         // Status bar background
841
-        execute!(
839
+        queue!(
842840
             self.stdout,
843841
             SetBackgroundColor(Color::DarkGrey),
844842
             SetForegroundColor(Color::White)
@@ -867,7 +865,7 @@ impl Screen {
867865
         let padding = (self.cols as usize).saturating_sub(left.len() + right.len());
868866
         let middle = " ".repeat(padding);
869867
 
870
-        execute!(
868
+        queue!(
871869
             self.stdout,
872870
             Print(&left),
873871
             Print(&middle),
@@ -907,7 +905,7 @@ impl Screen {
907905
         let tree_rows = text_rows.saturating_sub(hint_rows + header_rows);
908906
 
909907
         // Draw header: repo_name:branch
910
-        execute!(self.stdout, MoveTo(0, 0))?;
908
+        queue!(self.stdout, MoveTo(0, 0))?;
911909
         let header_text = if let Some(b) = branch {
912910
             format!("{}:{}", repo_name, b)
913911
         } else {
@@ -917,15 +915,15 @@ impl Screen {
917915
         let padded = format!("{:<width$}", truncated, width = width);
918916
 
919917
         // Render header with cyan repo name, yellow branch
920
-        execute!(
918
+        queue!(
921919
             self.stdout,
922920
             SetBackgroundColor(BG_COLOR),
923921
             SetForegroundColor(Color::Cyan),
924922
         )?;
925923
         if let Some(b) = branch {
926924
             let repo_display: String = repo_name.chars().take(width.saturating_sub(1)).collect();
927
-            execute!(self.stdout, Print(&repo_display))?;
928
-            execute!(
925
+            queue!(self.stdout, Print(&repo_display))?;
926
+            queue!(
929927
                 self.stdout,
930928
                 SetForegroundColor(Color::DarkGrey),
931929
                 Print(":"),
@@ -934,16 +932,16 @@ impl Screen {
934932
             let remaining = width.saturating_sub(repo_display.len() + 1);
935933
             let branch_display: String = b.chars().take(remaining).collect();
936934
             let branch_padded = format!("{:<width$}", branch_display, width = remaining);
937
-            execute!(self.stdout, Print(&branch_padded))?;
935
+            queue!(self.stdout, Print(&branch_padded))?;
938936
         } else {
939
-            execute!(self.stdout, Print(&padded))?;
937
+            queue!(self.stdout, Print(&padded))?;
940938
         }
941
-        execute!(self.stdout, ResetColor)?;
939
+        queue!(self.stdout, ResetColor)?;
942940
 
943941
         // Draw separator
944
-        execute!(self.stdout, MoveTo(0, 1))?;
942
+        queue!(self.stdout, MoveTo(0, 1))?;
945943
         let separator = "─".repeat(width);
946
-        execute!(
944
+        queue!(
947945
             self.stdout,
948946
             SetBackgroundColor(BG_COLOR),
949947
             SetForegroundColor(Color::DarkGrey),
@@ -954,10 +952,10 @@ impl Screen {
954952
         // Draw git mode indicator line
955953
         if git_mode {
956954
             let git_row = 2u16;
957
-            execute!(self.stdout, MoveTo(0, git_row))?;
955
+            queue!(self.stdout, MoveTo(0, git_row))?;
958956
             let git_hint = "Git: a/u/d/m/p/l/f/t";
959957
             let padded = format!("{:<width$}", git_hint, width = width);
960
-            execute!(
958
+            queue!(
961959
                 self.stdout,
962960
                 SetBackgroundColor(Color::AnsiValue(235)),
963961
                 SetForegroundColor(Color::Yellow),
@@ -969,7 +967,7 @@ impl Screen {
969967
         // Draw file tree (starting after header)
970968
         for row in 0..tree_rows {
971969
             let screen_row = (row + header_rows) as u16;
972
-            execute!(self.stdout, MoveTo(0, screen_row))?;
970
+            queue!(self.stdout, MoveTo(0, screen_row))?;
973971
 
974972
             let item_idx = scroll + row;
975973
             if item_idx < items.len() {
@@ -1010,7 +1008,7 @@ impl Screen {
10101008
                     // Highlight selected - need to handle git indicator specially
10111009
                     let padded_len = width.saturating_sub(indicator_display_len);
10121010
                     let padded = format!("{:<width$}", display_base, width = padded_len);
1013
-                    execute!(
1011
+                    queue!(
10141012
                         self.stdout,
10151013
                         SetBackgroundColor(Color::DarkGrey),
10161014
                         SetForegroundColor(Color::White),
@@ -1019,21 +1017,21 @@ impl Screen {
10191017
                     if !git_indicator.is_empty() {
10201018
                         // Git indicator with selection background
10211019
                         if item.git_status.staged {
1022
-                            execute!(self.stdout, SetForegroundColor(Color::Green), Print(" ↑"))?;
1020
+                            queue!(self.stdout, SetForegroundColor(Color::Green), Print(" ↑"))?;
10231021
                         } else if item.git_status.unstaged {
1024
-                            execute!(self.stdout, SetForegroundColor(Color::Red), Print(" ✗"))?;
1022
+                            queue!(self.stdout, SetForegroundColor(Color::Red), Print(" ✗"))?;
10251023
                         } else if item.git_status.untracked {
1026
-                            execute!(self.stdout, SetForegroundColor(Color::DarkGrey), Print(" ?"))?;
1024
+                            queue!(self.stdout, SetForegroundColor(Color::DarkGrey), Print(" ?"))?;
10271025
                         } else if item.git_status.incoming {
1028
-                            execute!(self.stdout, SetForegroundColor(Color::Blue), Print(" ↓"))?;
1026
+                            queue!(self.stdout, SetForegroundColor(Color::Blue), Print(" ↓"))?;
10291027
                         }
10301028
                     }
1031
-                    execute!(self.stdout, ResetColor)?;
1029
+                    queue!(self.stdout, ResetColor)?;
10321030
                 } else if item.is_dir {
10331031
                     // Directories in blue
10341032
                     let padded_len = width.saturating_sub(indicator_display_len);
10351033
                     let padded = format!("{:<width$}", display_base, width = padded_len);
1036
-                    execute!(
1034
+                    queue!(
10371035
                         self.stdout,
10381036
                         SetBackgroundColor(BG_COLOR),
10391037
                         SetForegroundColor(Color::Blue),
@@ -1043,7 +1041,7 @@ impl Screen {
10431041
                 } else if item.git_status.gitignored {
10441042
                     // Gitignored files in dark gray
10451043
                     let padded = format!("{:<width$}", display_base, width = width);
1046
-                    execute!(
1044
+                    queue!(
10471045
                         self.stdout,
10481046
                         SetBackgroundColor(BG_COLOR),
10491047
                         SetForegroundColor(Color::DarkGrey),
@@ -1054,7 +1052,7 @@ impl Screen {
10541052
                     // Files in default color with git status
10551053
                     let padded_len = width.saturating_sub(indicator_display_len);
10561054
                     let padded = format!("{:<width$}", display_base, width = padded_len);
1057
-                    execute!(
1055
+                    queue!(
10581056
                         self.stdout,
10591057
                         SetBackgroundColor(BG_COLOR),
10601058
                         SetForegroundColor(Color::Reset),
@@ -1062,20 +1060,20 @@ impl Screen {
10621060
                     )?;
10631061
                     // Add git status indicator
10641062
                     if item.git_status.staged {
1065
-                        execute!(self.stdout, SetForegroundColor(Color::Green), Print(" ↑"))?;
1063
+                        queue!(self.stdout, SetForegroundColor(Color::Green), Print(" ↑"))?;
10661064
                     } else if item.git_status.unstaged {
1067
-                        execute!(self.stdout, SetForegroundColor(Color::Red), Print(" ✗"))?;
1065
+                        queue!(self.stdout, SetForegroundColor(Color::Red), Print(" ✗"))?;
10681066
                     } else if item.git_status.untracked {
1069
-                        execute!(self.stdout, SetForegroundColor(Color::DarkGrey), Print(" ?"))?;
1067
+                        queue!(self.stdout, SetForegroundColor(Color::DarkGrey), Print(" ?"))?;
10701068
                     } else if item.git_status.incoming {
1071
-                        execute!(self.stdout, SetForegroundColor(Color::Blue), Print(" ↓"))?;
1069
+                        queue!(self.stdout, SetForegroundColor(Color::Blue), Print(" ↓"))?;
10721070
                     }
1073
-                    execute!(self.stdout, ResetColor)?;
1071
+                    queue!(self.stdout, ResetColor)?;
10741072
                 }
10751073
             } else {
10761074
                 // Empty row
10771075
                 let empty = " ".repeat(width);
1078
-                execute!(
1076
+                queue!(
10791077
                     self.stdout,
10801078
                     SetBackgroundColor(BG_COLOR),
10811079
                     Print(&empty),
@@ -1095,9 +1093,9 @@ impl Screen {
10951093
             ];
10961094
             for (i, hint) in hints.iter().enumerate() {
10971095
                 if hint_start + i < text_rows {
1098
-                    execute!(self.stdout, MoveTo(0, (hint_start + i) as u16))?;
1096
+                    queue!(self.stdout, MoveTo(0, (hint_start + i) as u16))?;
10991097
                     let padded = format!("{:<width$}", hint, width = width);
1100
-                    execute!(
1098
+                    queue!(
11011099
                         self.stdout,
11021100
                         SetBackgroundColor(BG_COLOR),
11031101
                         SetForegroundColor(Color::DarkGrey),
@@ -1108,10 +1106,10 @@ impl Screen {
11081106
             }
11091107
         } else {
11101108
             if hint_start < text_rows {
1111
-                execute!(self.stdout, MoveTo(0, hint_start as u16))?;
1109
+                queue!(self.stdout, MoveTo(0, hint_start as u16))?;
11121110
                 let hint = "ctrl-/:hints";
11131111
                 let padded = format!("{:<width$}", hint, width = width);
1114
-                execute!(
1112
+                queue!(
11151113
                     self.stdout,
11161114
                     SetBackgroundColor(BG_COLOR),
11171115
                     SetForegroundColor(Color::DarkGrey),
@@ -1123,9 +1121,9 @@ impl Screen {
11231121
 
11241122
         // Fill the status bar row for fuss mode column (prevents terminal bleed-through)
11251123
         let status_row = self.rows.saturating_sub(1);
1126
-        execute!(self.stdout, MoveTo(0, status_row))?;
1124
+        queue!(self.stdout, MoveTo(0, status_row))?;
11271125
         let status_fill = " ".repeat(width);
1128
-        execute!(
1126
+        queue!(
11291127
             self.stdout,
11301128
             SetBackgroundColor(BG_COLOR),
11311129
             Print(&status_fill),
@@ -1149,9 +1147,6 @@ impl Screen {
11491147
         top_offset: u16,
11501148
         is_modified: bool,
11511149
     ) -> Result<()> {
1152
-        // Hide cursor during render to prevent flicker
1153
-        execute!(self.stdout, Hide)?;
1154
-
11551150
         let available_cols = self.cols.saturating_sub(left_offset) as usize;
11561151
         let line_num_width = self.line_number_width(buffer.line_count());
11571152
         let text_cols = available_cols.saturating_sub(line_num_width + 1);
@@ -1180,7 +1175,7 @@ impl Screen {
11801175
         for row in 0..text_rows {
11811176
             let line_idx = viewport_line + row;
11821177
             let is_current_line = line_idx == primary.line;
1183
-            execute!(self.stdout, MoveTo(left_offset, (row as u16) + top_offset))?;
1178
+            queue!(self.stdout, MoveTo(left_offset, (row as u16) + top_offset))?;
11841179
 
11851180
             if line_idx < buffer.line_count() {
11861181
                 let line_num_fg = if is_current_line {
@@ -1190,7 +1185,7 @@ impl Screen {
11901185
                 };
11911186
                 let line_bg = if is_current_line { CURRENT_LINE_BG } else { BG_COLOR };
11921187
 
1193
-                execute!(
1188
+                queue!(
11941189
                     self.stdout,
11951190
                     SetBackgroundColor(line_bg),
11961191
                     SetForegroundColor(line_num_fg),
@@ -1218,14 +1213,14 @@ impl Screen {
12181213
                     )?;
12191214
                 }
12201215
 
1221
-                execute!(
1216
+                queue!(
12221217
                     self.stdout,
12231218
                     SetBackgroundColor(line_bg),
12241219
                     Clear(ClearType::UntilNewLine),
12251220
                     ResetColor
12261221
                 )?;
12271222
             } else {
1228
-                execute!(
1223
+                queue!(
12291224
                     self.stdout,
12301225
                     SetBackgroundColor(BG_COLOR),
12311226
                     SetForegroundColor(Color::DarkBlue),
@@ -1238,7 +1233,7 @@ impl Screen {
12381233
 
12391234
         // Render the gap row (empty line between text and status bar)
12401235
         let gap_row = text_rows as u16 + top_offset;
1241
-        execute!(
1236
+        queue!(
12421237
             self.stdout,
12431238
             MoveTo(left_offset, gap_row),
12441239
             SetBackgroundColor(BG_COLOR),
@@ -1249,16 +1244,14 @@ impl Screen {
12491244
         // Status bar
12501245
         self.render_status_bar_with_offset(cursors, filename, message, left_offset, is_modified)?;
12511246
 
1252
-        // Position hardware cursor at primary cursor
1247
+        // Position hardware cursor at primary cursor (but don't show - caller handles that)
12531248
         let cursor_row = (primary.line.saturating_sub(viewport_line) as u16) + top_offset;
12541249
         let cursor_col = left_offset as usize + line_num_width + 1 + primary.col;
1255
-        execute!(
1250
+        queue!(
12561251
             self.stdout,
12571252
             MoveTo(cursor_col as u16, cursor_row),
1258
-            Show
12591253
         )?;
12601254
 
1261
-        self.stdout.flush()?;
12621255
         Ok(())
12631256
     }
12641257
 
@@ -1278,8 +1271,6 @@ impl Screen {
12781271
         highlighter: &mut Highlighter,
12791272
         ghost_text: Option<&str>,
12801273
     ) -> Result<()> {
1281
-        execute!(self.stdout, Hide)?;
1282
-
12831274
         let available_cols = self.cols.saturating_sub(left_offset) as usize;
12841275
         let line_num_width = self.line_number_width(buffer.line_count());
12851276
         let text_cols = available_cols.saturating_sub(line_num_width + 1);
@@ -1327,7 +1318,7 @@ impl Screen {
13271318
         for row in 0..text_rows {
13281319
             let line_idx = viewport_line + row;
13291320
             let is_current_line = line_idx == primary.line;
1330
-            execute!(self.stdout, MoveTo(left_offset, (row as u16) + top_offset))?;
1321
+            queue!(self.stdout, MoveTo(left_offset, (row as u16) + top_offset))?;
13311322
 
13321323
             if line_idx < buffer.line_count() {
13331324
                 let line_num_fg = if is_current_line {
@@ -1337,7 +1328,7 @@ impl Screen {
13371328
                 };
13381329
                 let line_bg = if is_current_line { CURRENT_LINE_BG } else { BG_COLOR };
13391330
 
1340
-                execute!(
1331
+                queue!(
13411332
                     self.stdout,
13421333
                     SetBackgroundColor(line_bg),
13431334
                     SetForegroundColor(line_num_fg),
@@ -1400,7 +1391,7 @@ impl Screen {
14001391
                             if remaining_cols > 0 {
14011392
                                 // Truncate ghost text if it doesn't fit
14021393
                                 let ghost_display: String = ghost.chars().take(remaining_cols).collect();
1403
-                                execute!(
1394
+                                queue!(
14041395
                                     self.stdout,
14051396
                                     SetBackgroundColor(line_bg),
14061397
                                     SetForegroundColor(Color::AnsiValue(240)), // Dim gray
@@ -1411,14 +1402,14 @@ impl Screen {
14111402
                     }
14121403
                 }
14131404
 
1414
-                execute!(
1405
+                queue!(
14151406
                     self.stdout,
14161407
                     SetBackgroundColor(line_bg),
14171408
                     Clear(ClearType::UntilNewLine),
14181409
                     ResetColor
14191410
                 )?;
14201411
             } else {
1421
-                execute!(
1412
+                queue!(
14221413
                     self.stdout,
14231414
                     SetBackgroundColor(BG_COLOR),
14241415
                     SetForegroundColor(Color::DarkBlue),
@@ -1431,7 +1422,7 @@ impl Screen {
14311422
 
14321423
         // Render the gap row (empty line between text and status bar)
14331424
         let gap_row = text_rows as u16 + top_offset;
1434
-        execute!(
1425
+        queue!(
14351426
             self.stdout,
14361427
             MoveTo(left_offset, gap_row),
14371428
             SetBackgroundColor(BG_COLOR),
@@ -1442,16 +1433,14 @@ impl Screen {
14421433
         // Status bar
14431434
         self.render_status_bar_with_offset(cursors, filename, message, left_offset, is_modified)?;
14441435
 
1445
-        // Position hardware cursor (adjusted for horizontal scroll)
1436
+        // Position hardware cursor (adjusted for horizontal scroll, but don't show - caller handles that)
14461437
         let cursor_row = (primary.line.saturating_sub(viewport_line) as u16) + top_offset;
14471438
         let cursor_col = left_offset as usize + line_num_width + 1 + primary.col.saturating_sub(viewport_col);
1448
-        execute!(
1439
+        queue!(
14491440
             self.stdout,
14501441
             MoveTo(cursor_col as u16, cursor_row),
1451
-            Show
14521442
         )?;
14531443
 
1454
-        self.stdout.flush()?;
14551444
         Ok(())
14561445
     }
14571446
 
@@ -1465,9 +1454,9 @@ impl Screen {
14651454
     ) -> Result<()> {
14661455
         let status_row = self.rows.saturating_sub(1);
14671456
         let available_cols = self.cols.saturating_sub(offset) as usize;
1468
-        execute!(self.stdout, MoveTo(offset, status_row))?;
1457
+        queue!(self.stdout, MoveTo(offset, status_row))?;
14691458
 
1470
-        execute!(
1459
+        queue!(
14711460
             self.stdout,
14721461
             SetBackgroundColor(Color::DarkGrey),
14731462
             SetForegroundColor(Color::White)
@@ -1493,7 +1482,7 @@ impl Screen {
14931482
         let padding = available_cols.saturating_sub(left.len() + right.len());
14941483
         let middle = " ".repeat(padding);
14951484
 
1496
-        execute!(
1485
+        queue!(
14971486
             self.stdout,
14981487
             Print(&left),
14991488
             Print(&middle),
@@ -1510,14 +1499,14 @@ impl Screen {
15101499
         items: &[(String, String, bool, bool)], // (label, path, is_selected, is_current_dir)
15111500
         scroll: usize,
15121501
     ) -> Result<()> {
1513
-        execute!(self.stdout, Hide)?;
1502
+        queue!(self.stdout, Hide)?;
15141503
 
15151504
         let cols = self.cols as usize;
15161505
         let rows = self.rows as usize;
15171506
 
15181507
         // Fill background
15191508
         for row in 0..rows {
1520
-            execute!(
1509
+            queue!(
15211510
                 self.stdout,
15221511
                 MoveTo(0, row as u16),
15231512
                 SetBackgroundColor(BG_COLOR),
@@ -1535,7 +1524,7 @@ impl Screen {
15351524
         let top_border = format!("╭{}╮", "─".repeat(box_width.saturating_sub(2)));
15361525
         let bottom_border = format!("╰{}╯", "─".repeat(box_width.saturating_sub(2)));
15371526
 
1538
-        execute!(
1527
+        queue!(
15391528
             self.stdout,
15401529
             MoveTo(box_x as u16, box_y as u16),
15411530
             SetBackgroundColor(BG_COLOR),
@@ -1547,7 +1536,7 @@ impl Screen {
15471536
         let title = "Welcome to fackr";
15481537
         let title_row = box_y + 1;
15491538
         let title_x = box_x + (box_width.saturating_sub(title.len())) / 2;
1550
-        execute!(
1539
+        queue!(
15511540
             self.stdout,
15521541
             MoveTo(box_x as u16, title_row as u16),
15531542
             SetForegroundColor(Color::DarkGrey),
@@ -1556,7 +1545,7 @@ impl Screen {
15561545
         )?;
15571546
         let padding_left = title_x.saturating_sub(box_x + 1);
15581547
         let padding_right = box_width.saturating_sub(2).saturating_sub(padding_left + title.len());
1559
-        execute!(
1548
+        queue!(
15601549
             self.stdout,
15611550
             Print(&" ".repeat(padding_left)),
15621551
             Print(title),
@@ -1568,7 +1557,7 @@ impl Screen {
15681557
         // Subtitle
15691558
         let subtitle = "Select a workspace:";
15701559
         let subtitle_row = box_y + 2;
1571
-        execute!(
1560
+        queue!(
15721561
             self.stdout,
15731562
             MoveTo(box_x as u16, subtitle_row as u16),
15741563
             SetForegroundColor(Color::DarkGrey),
@@ -1577,7 +1566,7 @@ impl Screen {
15771566
         )?;
15781567
         let padding_left = (box_width.saturating_sub(2).saturating_sub(subtitle.len())) / 2;
15791568
         let padding_right = box_width.saturating_sub(2).saturating_sub(padding_left + subtitle.len());
1580
-        execute!(
1569
+        queue!(
15811570
             self.stdout,
15821571
             Print(&" ".repeat(padding_left)),
15831572
             Print(subtitle),
@@ -1588,7 +1577,7 @@ impl Screen {
15881577
 
15891578
         // Separator
15901579
         let separator_row = box_y + 3;
1591
-        execute!(
1580
+        queue!(
15921581
             self.stdout,
15931582
             MoveTo(box_x as u16, separator_row as u16),
15941583
             SetForegroundColor(Color::DarkGrey),
@@ -1606,7 +1595,7 @@ impl Screen {
16061595
             let row = list_start_row + i;
16071596
             let item_idx = scroll + i;
16081597
 
1609
-            execute!(
1598
+            queue!(
16101599
                 self.stdout,
16111600
                 MoveTo(box_x as u16, row as u16),
16121601
                 SetForegroundColor(Color::DarkGrey),
@@ -1621,7 +1610,7 @@ impl Screen {
16211610
                 let padded = format!("{:<width$}", display_label, width = inner_width);
16221611
 
16231612
                 if *is_selected {
1624
-                    execute!(
1613
+                    queue!(
16251614
                         self.stdout,
16261615
                         SetBackgroundColor(Color::DarkGrey),
16271616
                         SetForegroundColor(Color::White),
@@ -1629,13 +1618,13 @@ impl Screen {
16291618
                         SetBackgroundColor(BG_COLOR),
16301619
                     )?;
16311620
                 } else if *is_current_dir {
1632
-                    execute!(
1621
+                    queue!(
16331622
                         self.stdout,
16341623
                         SetForegroundColor(Color::Cyan),
16351624
                         Print(&padded),
16361625
                     )?;
16371626
                 } else {
1638
-                    execute!(
1627
+                    queue!(
16391628
                         self.stdout,
16401629
                         SetForegroundColor(Color::Reset),
16411630
                         Print(&padded),
@@ -1647,14 +1636,14 @@ impl Screen {
16471636
                     // Clear and show path below
16481637
                 }
16491638
             } else {
1650
-                execute!(
1639
+                queue!(
16511640
                     self.stdout,
16521641
                     SetForegroundColor(Color::Reset),
16531642
                     Print(&" ".repeat(inner_width)),
16541643
                 )?;
16551644
             }
16561645
 
1657
-            execute!(
1646
+            queue!(
16581647
                 self.stdout,
16591648
                 SetForegroundColor(Color::DarkGrey),
16601649
                 Print(" │"),
@@ -1663,7 +1652,7 @@ impl Screen {
16631652
 
16641653
         // Path display row (show selected path)
16651654
         let path_row = list_start_row + list_height;
1666
-        execute!(
1655
+        queue!(
16671656
             self.stdout,
16681657
             MoveTo(box_x as u16, path_row as u16),
16691658
             SetForegroundColor(Color::DarkGrey),
@@ -1675,7 +1664,7 @@ impl Screen {
16751664
         // Show selected path
16761665
         let selected_item = items.iter().find(|(_, _, sel, _)| *sel);
16771666
         let path_display_row = path_row + 1;
1678
-        execute!(
1667
+        queue!(
16791668
             self.stdout,
16801669
             MoveTo(box_x as u16, path_display_row as u16),
16811670
             SetForegroundColor(Color::DarkGrey),
@@ -1684,18 +1673,18 @@ impl Screen {
16841673
         if let Some((_, path, _, _)) = selected_item {
16851674
             let truncated_path: String = path.chars().take(inner_width).collect();
16861675
             let padded_path = format!("{:<width$}", truncated_path, width = inner_width);
1687
-            execute!(
1676
+            queue!(
16881677
                 self.stdout,
16891678
                 SetForegroundColor(Color::AnsiValue(240)),
16901679
                 Print(&padded_path),
16911680
             )?;
16921681
         } else {
1693
-            execute!(
1682
+            queue!(
16941683
                 self.stdout,
16951684
                 Print(&" ".repeat(inner_width)),
16961685
             )?;
16971686
         }
1698
-        execute!(
1687
+        queue!(
16991688
             self.stdout,
17001689
             SetForegroundColor(Color::DarkGrey),
17011690
             Print(" │"),
@@ -1703,7 +1692,7 @@ impl Screen {
17031692
 
17041693
         // Bottom border
17051694
         let bottom_row = path_display_row + 1;
1706
-        execute!(
1695
+        queue!(
17071696
             self.stdout,
17081697
             MoveTo(box_x as u16, bottom_row as u16),
17091698
             SetForegroundColor(Color::DarkGrey),
@@ -1714,7 +1703,7 @@ impl Screen {
17141703
         let hint_row = bottom_row + 1;
17151704
         let hints = "↑/↓: navigate  Enter: select  ESC: quit";
17161705
         let hints_x = (cols.saturating_sub(hints.len())) / 2;
1717
-        execute!(
1706
+        queue!(
17181707
             self.stdout,
17191708
             MoveTo(hints_x as u16, hint_row as u16),
17201709
             SetForegroundColor(Color::AnsiValue(240)),
@@ -1769,7 +1758,7 @@ impl Screen {
17691758
             let is_selected = i + scroll_offset == selected_index;
17701759
             let bg = if is_selected { selected_bg } else { popup_bg };
17711760
 
1772
-            execute!(
1761
+            queue!(
17731762
                 self.stdout,
17741763
                 MoveTo(popup_col, row),
17751764
                 SetBackgroundColor(bg),
@@ -1792,7 +1781,7 @@ impl Screen {
17921781
             write!(self.stdout, "{:<width$}", truncated_label, width = label_width - detail.len().min(15))?;
17931782
 
17941783
             if !detail.is_empty() {
1795
-                execute!(self.stdout, SetForegroundColor(detail_fg))?;
1784
+                queue!(self.stdout, SetForegroundColor(detail_fg))?;
17961785
                 let truncated_detail: String = if detail.len() > 12 {
17971786
                     format!("{}...", &detail[..9])
17981787
                 } else {
@@ -1802,13 +1791,13 @@ impl Screen {
18021791
             }
18031792
 
18041793
             // Clear to popup width
1805
-            execute!(self.stdout, ResetColor)?;
1794
+            queue!(self.stdout, ResetColor)?;
18061795
         }
18071796
 
18081797
         // Show scroll indicator if needed
18091798
         if completions.len() > max_items {
18101799
             let indicator_row = popup_row + max_items as u16;
1811
-            execute!(
1800
+            queue!(
18121801
                 self.stdout,
18131802
                 MoveTo(popup_col, indicator_row),
18141803
                 SetBackgroundColor(popup_bg),
@@ -1849,7 +1838,7 @@ impl Screen {
18491838
                 };
18501839
 
18511840
                 // Draw indicator at the start of the line (before line number)
1852
-                execute!(
1841
+                queue!(
18531842
                     self.stdout,
18541843
                     MoveTo(left_offset, row),
18551844
                     SetForegroundColor(color),
@@ -1910,7 +1899,7 @@ impl Screen {
19101899
             let row = popup_row + i as u16;
19111900
 
19121901
             // Background and border
1913
-            execute!(
1902
+            queue!(
19141903
                 self.stdout,
19151904
                 MoveTo(popup_col, row),
19161905
                 SetBackgroundColor(Color::AnsiValue(238)),
@@ -1924,13 +1913,13 @@ impl Screen {
19241913
                 format!(" {:width$} ", line, width = popup_width)
19251914
             };
19261915
 
1927
-            execute!(self.stdout, Print(&display_line), ResetColor)?;
1916
+            queue!(self.stdout, Print(&display_line), ResetColor)?;
19281917
         }
19291918
 
19301919
         // Show indicator if content is truncated
19311920
         if lines.len() > popup_height {
19321921
             let row = popup_row + popup_height as u16;
1933
-            execute!(
1922
+            queue!(
19341923
                 self.stdout,
19351924
                 MoveTo(popup_col, row),
19361925
                 SetBackgroundColor(Color::AnsiValue(238)),
@@ -1969,7 +1958,7 @@ impl Screen {
19691958
         let input_bg = Color::AnsiValue(238);
19701959
 
19711960
         // Draw top border
1972
-        execute!(
1961
+        queue!(
19731962
             self.stdout,
19741963
             MoveTo(start_col as u16, start_row as u16),
19751964
             SetBackgroundColor(bg),
@@ -1979,7 +1968,7 @@ impl Screen {
19791968
 
19801969
         // Draw title row
19811970
         let title_padding = (modal_width - 2 - title.len()) / 2;
1982
-        execute!(
1971
+        queue!(
19831972
             self.stdout,
19841973
             MoveTo(start_col as u16, start_row as u16 + 1),
19851974
             SetBackgroundColor(bg),
@@ -1992,7 +1981,7 @@ impl Screen {
19921981
         )?;
19931982
 
19941983
         // Draw separator
1995
-        execute!(
1984
+        queue!(
19961985
             self.stdout,
19971986
             MoveTo(start_col as u16, start_row as u16 + 2),
19981987
             SetBackgroundColor(bg),
@@ -2001,7 +1990,7 @@ impl Screen {
20011990
         )?;
20021991
 
20031992
         // Draw "From:" row
2004
-        execute!(
1993
+        queue!(
20051994
             self.stdout,
20061995
             MoveTo(start_col as u16, start_row as u16 + 3),
20071996
             SetBackgroundColor(bg),
@@ -2017,7 +2006,7 @@ impl Screen {
20172006
 
20182007
         // Draw "To:" row with input field
20192008
         let input_width = modal_width - 4 - to_label.len();
2020
-        execute!(
2009
+        queue!(
20212010
             self.stdout,
20222011
             MoveTo(start_col as u16, start_row as u16 + 4),
20232012
             SetBackgroundColor(bg),
@@ -2034,7 +2023,7 @@ impl Screen {
20342023
         )?;
20352024
 
20362025
         // Draw bottom border
2037
-        execute!(
2026
+        queue!(
20382027
             self.stdout,
20392028
             MoveTo(start_col as u16, start_row as u16 + 5),
20402029
             SetBackgroundColor(bg),
@@ -2045,12 +2034,13 @@ impl Screen {
20452034
 
20462035
         // Position cursor in the input field
20472036
         let cursor_col = start_col + 2 + to_label.len() + new_name.len();
2048
-        execute!(
2037
+        queue!(
20492038
             self.stdout,
20502039
             MoveTo(cursor_col as u16, start_row as u16 + 4),
20512040
             SetBackgroundColor(input_bg),
20522041
             crossterm::cursor::Show,
20532042
         )?;
2043
+        self.stdout.flush()?;
20542044
 
20552045
         Ok(())
20562046
     }
@@ -2070,7 +2060,7 @@ impl Screen {
20702060
         let status_row = self.rows.saturating_sub(1);
20712061
         let available_cols = (self.cols.saturating_sub(left_offset)) as usize;
20722062
 
2073
-        execute!(self.stdout, MoveTo(left_offset, status_row))?;
2063
+        queue!(self.stdout, MoveTo(left_offset, status_row))?;
20742064
 
20752065
         // Colors
20762066
         let bg = Color::DarkGrey;
@@ -2090,13 +2080,13 @@ impl Screen {
20902080
         let input_width = input_width.max(10).min(40);
20912081
 
20922082
         // Start with background
2093
-        execute!(self.stdout, SetBackgroundColor(bg))?;
2083
+        queue!(self.stdout, SetBackgroundColor(bg))?;
20942084
 
20952085
         // Find label and input
20962086
         let find_bg = if active_field { active_bg } else { inactive_bg };
20972087
         let find_label_color = if active_field { active_label } else { label_color };
20982088
 
2099
-        execute!(
2089
+        queue!(
21002090
             self.stdout,
21012091
             SetForegroundColor(find_label_color),
21022092
             Print(find_label),
@@ -2110,13 +2100,13 @@ impl Screen {
21102100
         } else {
21112101
             format!("{:<width$}", find_query, width = input_width)
21122102
         };
2113
-        execute!(self.stdout, Print(&find_display))?;
2103
+        queue!(self.stdout, Print(&find_display))?;
21142104
 
21152105
         // Replace label and input
21162106
         let replace_bg = if !active_field { active_bg } else { inactive_bg };
21172107
         let replace_label_color = if !active_field { active_label } else { label_color };
21182108
 
2119
-        execute!(
2109
+        queue!(
21202110
             self.stdout,
21212111
             SetBackgroundColor(bg),
21222112
             SetForegroundColor(replace_label_color),
@@ -2131,14 +2121,14 @@ impl Screen {
21312121
         } else {
21322122
             format!("{:<width$}", replace_text, width = input_width)
21332123
         };
2134
-        execute!(self.stdout, Print(&replace_display))?;
2124
+        queue!(self.stdout, Print(&replace_display))?;
21352125
 
21362126
         // Toggle buttons
2137
-        execute!(self.stdout, SetBackgroundColor(bg))?;
2127
+        queue!(self.stdout, SetBackgroundColor(bg))?;
21382128
 
21392129
         // Regex toggle [.*]
21402130
         let regex_color = if regex_mode { toggle_on } else { toggle_off };
2141
-        execute!(
2131
+        queue!(
21422132
             self.stdout,
21432133
             Print(" "),
21442134
             SetForegroundColor(regex_color),
@@ -2147,7 +2137,7 @@ impl Screen {
21472137
 
21482138
         // Case sensitivity toggle [Aa]
21492139
         let case_color = if case_insensitive { toggle_on } else { toggle_off };
2150
-        execute!(
2140
+        queue!(
21512141
             self.stdout,
21522142
             Print(" "),
21532143
             SetForegroundColor(case_color),
@@ -2155,14 +2145,14 @@ impl Screen {
21552145
         )?;
21562146
 
21572147
         // Match count
2158
-        execute!(self.stdout, SetForegroundColor(label_color))?;
2148
+        queue!(self.stdout, SetForegroundColor(label_color))?;
21592149
         if match_count > 0 {
2160
-            execute!(
2150
+            queue!(
21612151
                 self.stdout,
21622152
                 Print(format!(" {}/{}", current_match + 1, match_count)),
21632153
             )?;
21642154
         } else if !find_query.is_empty() {
2165
-            execute!(self.stdout, Print(" No matches"))?;
2155
+            queue!(self.stdout, Print(" No matches"))?;
21662156
         }
21672157
 
21682158
         // Fill remaining space
@@ -2171,7 +2161,7 @@ impl Screen {
21712161
             else if !find_query.is_empty() { 11 }
21722162
             else { 0 };
21732163
         let remaining = available_cols.saturating_sub(used);
2174
-        execute!(
2164
+        queue!(
21752165
             self.stdout,
21762166
             Print(" ".repeat(remaining)),
21772167
             ResetColor,
@@ -2183,11 +2173,12 @@ impl Screen {
21832173
         } else {
21842174
             left_offset as usize + find_label.len() + input_width + replace_label.len() + replace_text.len().min(input_width)
21852175
         };
2186
-        execute!(
2176
+        queue!(
21872177
             self.stdout,
21882178
             MoveTo(cursor_col as u16, status_row),
21892179
             crossterm::cursor::Show,
21902180
         )?;
2181
+        self.stdout.flush()?;
21912182
 
21922183
         Ok(())
21932184
     }
@@ -2237,7 +2228,7 @@ impl Screen {
22372228
             path_str.to_string()
22382229
         };
22392230
         let title = format!(" {} ", display_path);
2240
-        execute!(
2231
+        queue!(
22412232
             self.stdout,
22422233
             MoveTo(start_col as u16, start_row as u16),
22432234
             SetBackgroundColor(bg),
@@ -2251,7 +2242,7 @@ impl Screen {
22512242
         )?;
22522243
 
22532244
         // Draw filter input row
2254
-        execute!(
2245
+        queue!(
22552246
             self.stdout,
22562247
             MoveTo(start_col as u16, (start_row + 1) as u16),
22572248
             SetBackgroundColor(bg),
@@ -2269,7 +2260,7 @@ impl Screen {
22692260
         )?;
22702261
 
22712262
         // Draw separator
2272
-        execute!(
2263
+        queue!(
22732264
             self.stdout,
22742265
             MoveTo(start_col as u16, (start_row + 2) as u16),
22752266
             SetBackgroundColor(bg),
@@ -2307,7 +2298,7 @@ impl Screen {
23072298
                 name.clone()
23082299
             };
23092300
 
2310
-            execute!(
2301
+            queue!(
23112302
                 self.stdout,
23122303
                 MoveTo(start_col as u16, row),
23132304
                 SetBackgroundColor(item_bg),
@@ -2326,7 +2317,7 @@ impl Screen {
23262317
         let items_drawn = filtered.len().saturating_sub(scroll).min(visible_rows);
23272318
         for i in items_drawn..visible_rows {
23282319
             let row = (start_row + 3 + i) as u16;
2329
-            execute!(
2320
+            queue!(
23302321
                 self.stdout,
23312322
                 MoveTo(start_col as u16, row),
23322323
                 SetBackgroundColor(bg),
@@ -2339,7 +2330,7 @@ impl Screen {
23392330
         // Draw help text row
23402331
         let help_row = (start_row + 3 + visible_rows) as u16;
23412332
         let help_text = "←:up  →/Enter:open  ↑↓:nav  Esc:close";
2342
-        execute!(
2333
+        queue!(
23432334
             self.stdout,
23442335
             MoveTo(start_col as u16, help_row),
23452336
             SetBackgroundColor(bg),
@@ -2353,7 +2344,7 @@ impl Screen {
23532344
         )?;
23542345
 
23552346
         // Draw bottom border
2356
-        execute!(
2347
+        queue!(
23572348
             self.stdout,
23582349
             MoveTo(start_col as u16, help_row + 1),
23592350
             SetBackgroundColor(bg),
@@ -2363,7 +2354,7 @@ impl Screen {
23632354
         )?;
23642355
 
23652356
         // Hide cursor when in fortress modal
2366
-        execute!(self.stdout, Hide)?;
2357
+        queue!(self.stdout, Hide)?;
23672358
 
23682359
         self.stdout.flush()?;
23692360
         Ok(())
@@ -2398,7 +2389,7 @@ impl Screen {
23982389
 
23992390
         // Draw top border with title
24002391
         let title = " Search in Files (F4) ";
2401
-        execute!(
2392
+        queue!(
24022393
             self.stdout,
24032394
             MoveTo(start_col as u16, start_row as u16),
24042395
             SetBackgroundColor(bg),
@@ -2422,7 +2413,7 @@ impl Screen {
24222413
             "Type query, press Enter"
24232414
         };
24242415
         let input_width = modal_width.saturating_sub(14 + status.len());
2425
-        execute!(
2416
+        queue!(
24262417
             self.stdout,
24272418
             MoveTo(start_col as u16, (start_row + 1) as u16),
24282419
             SetBackgroundColor(bg),
@@ -2447,7 +2438,7 @@ impl Screen {
24472438
         } else {
24482439
             format!(" {} results ", results.len())
24492440
         };
2450
-        execute!(
2441
+        queue!(
24512442
             self.stdout,
24522443
             MoveTo(start_col as u16, (start_row + 2) as u16),
24532444
             SetBackgroundColor(bg),
@@ -2501,7 +2492,7 @@ impl Screen {
25012492
                 content.clone()
25022493
             };
25032494
 
2504
-            execute!(
2495
+            queue!(
25052496
                 self.stdout,
25062497
                 MoveTo(start_col as u16, row),
25072498
                 SetBackgroundColor(item_bg),
@@ -2521,7 +2512,7 @@ impl Screen {
25212512
             // Calculate remaining width and print content with padding
25222513
             let used = display_path.len() + 1 + line_str.len() + 2 + 2;
25232514
             let remaining = modal_width.saturating_sub(used + 2);
2524
-            execute!(
2515
+            queue!(
25252516
                 self.stdout,
25262517
                 Print(format!("{:<width$}", display_content, width = remaining)),
25272518
                 SetForegroundColor(border_color),
@@ -2534,7 +2525,7 @@ impl Screen {
25342525
         let items_drawn = results.len().saturating_sub(scroll).min(visible_rows);
25352526
         for i in items_drawn..visible_rows {
25362527
             let row = (start_row + 3 + i) as u16;
2537
-            execute!(
2528
+            queue!(
25382529
                 self.stdout,
25392530
                 MoveTo(start_col as u16, row),
25402531
                 SetBackgroundColor(bg),
@@ -2547,7 +2538,7 @@ impl Screen {
25472538
         // Draw help text row
25482539
         let help_row = (start_row + 3 + visible_rows) as u16;
25492540
         let help_text = "Enter:search/open  ↑↓:nav  PgUp/Dn:scroll  Esc:close";
2550
-        execute!(
2541
+        queue!(
25512542
             self.stdout,
25522543
             MoveTo(start_col as u16, help_row),
25532544
             SetBackgroundColor(bg),
@@ -2561,7 +2552,7 @@ impl Screen {
25612552
         )?;
25622553
 
25632554
         // Draw bottom border
2564
-        execute!(
2555
+        queue!(
25652556
             self.stdout,
25662557
             MoveTo(start_col as u16, help_row + 1),
25672558
             SetBackgroundColor(bg),
@@ -2571,7 +2562,7 @@ impl Screen {
25712562
         )?;
25722563
 
25732564
         // Hide cursor when in modal
2574
-        execute!(self.stdout, Hide)?;
2565
+        queue!(self.stdout, Hide)?;
25752566
 
25762567
         self.stdout.flush()?;
25772568
         Ok(())
@@ -2606,7 +2597,7 @@ impl Screen {
26062597
         let prompt_color = Color::Yellow;
26072598
 
26082599
         // Draw top border with subtle styling
2609
-        execute!(
2600
+        queue!(
26102601
             self.stdout,
26112602
             MoveTo(start_col as u16, start_row as u16),
26122603
             SetBackgroundColor(bg),
@@ -2618,7 +2609,7 @@ impl Screen {
26182609
         // Draw search input row with > prefix
26192610
         let display_query = if query.is_empty() { "" } else { query };
26202611
         let input_display_width = modal_width.saturating_sub(6);
2621
-        execute!(
2612
+        queue!(
26222613
             self.stdout,
26232614
             MoveTo(start_col as u16, (start_row + 1) as u16),
26242615
             SetBackgroundColor(bg),
@@ -2638,7 +2629,7 @@ impl Screen {
26382629
         )?;
26392630
 
26402631
         // Draw separator
2641
-        execute!(
2632
+        queue!(
26422633
             self.stdout,
26432634
             MoveTo(start_col as u16, (start_row + 2) as u16),
26442635
             SetBackgroundColor(bg),
@@ -2684,7 +2675,7 @@ impl Screen {
26842675
                 name.clone()
26852676
             };
26862677
 
2687
-            execute!(
2678
+            queue!(
26882679
                 self.stdout,
26892680
                 MoveTo(start_col as u16, row),
26902681
                 SetBackgroundColor(item_bg),
@@ -2697,7 +2688,7 @@ impl Screen {
26972688
 
26982689
             // Print name with padding
26992690
             let name_padding = name_width.saturating_sub(display_name.len());
2700
-            execute!(
2691
+            queue!(
27012692
                 self.stdout,
27022693
                 Print(&display_name),
27032694
                 Print(format!("{:width$}", "", width = name_padding)),
@@ -2713,7 +2704,7 @@ impl Screen {
27132704
         let items_drawn = commands.len().saturating_sub(scroll).min(visible_rows);
27142705
         for i in items_drawn..visible_rows {
27152706
             let row = (start_row + 3 + i) as u16;
2716
-            execute!(
2707
+            queue!(
27172708
                 self.stdout,
27182709
                 MoveTo(start_col as u16, row),
27192710
                 SetBackgroundColor(bg),
@@ -2731,7 +2722,7 @@ impl Screen {
27312722
         } else {
27322723
             format!("{} commands", commands.len())
27332724
         };
2734
-        execute!(
2725
+        queue!(
27352726
             self.stdout,
27362727
             MoveTo(start_col as u16, help_row),
27372728
             SetBackgroundColor(bg),
@@ -2746,7 +2737,7 @@ impl Screen {
27462737
         )?;
27472738
 
27482739
         // Draw bottom border
2749
-        execute!(
2740
+        queue!(
27502741
             self.stdout,
27512742
             MoveTo(start_col as u16, help_row + 1),
27522743
             SetBackgroundColor(bg),
@@ -2756,7 +2747,7 @@ impl Screen {
27562747
         )?;
27572748
 
27582749
         // Show help in lighter text at bottom
2759
-        execute!(
2750
+        queue!(
27602751
             self.stdout,
27612752
             MoveTo(start_col as u16, help_row + 2),
27622753
             SetForegroundColor(Color::AnsiValue(243)),
@@ -2765,7 +2756,7 @@ impl Screen {
27652756
         )?;
27662757
 
27672758
         // Hide cursor when in modal
2768
-        execute!(self.stdout, Hide)?;
2759
+        queue!(self.stdout, Hide)?;
27692760
 
27702761
         self.stdout.flush()?;
27712762
         Ok(())
@@ -2801,7 +2792,7 @@ impl Screen {
28012792
         // Draw top border with title (show indicator when viewing alternates)
28022793
         let title = if show_alt { " Keybindings [/] " } else { " Keybindings " };
28032794
         let title_padding = (modal_width.saturating_sub(title.len() + 2)) / 2;
2804
-        execute!(
2795
+        queue!(
28052796
             self.stdout,
28062797
             MoveTo(start_col as u16, start_row as u16),
28072798
             SetBackgroundColor(bg),
@@ -2822,7 +2813,7 @@ impl Screen {
28222813
         let display_query = if query.is_empty() { "Type to filter..." } else { query };
28232814
         let input_display_width = modal_width.saturating_sub(5);
28242815
         let placeholder_color = if query.is_empty() { Color::AnsiValue(243) } else { Color::White };
2825
-        execute!(
2816
+        queue!(
28262817
             self.stdout,
28272818
             MoveTo(start_col as u16, (start_row + 1) as u16),
28282819
             SetBackgroundColor(bg),
@@ -2838,7 +2829,7 @@ impl Screen {
28382829
         )?;
28392830
 
28402831
         // Draw separator
2841
-        execute!(
2832
+        queue!(
28422833
             self.stdout,
28432834
             MoveTo(start_col as u16, (start_row + 2) as u16),
28442835
             SetBackgroundColor(bg),
@@ -2890,7 +2881,7 @@ impl Screen {
28902881
                 shortcut.clone()
28912882
             };
28922883
 
2893
-            execute!(
2884
+            queue!(
28942885
                 self.stdout,
28952886
                 MoveTo(start_col as u16, row),
28962887
                 SetBackgroundColor(item_bg),
@@ -2916,7 +2907,7 @@ impl Screen {
29162907
         // Fill remaining rows
29172908
         for i in row_offset..visible_rows {
29182909
             let row = (start_row + 3 + i) as u16;
2919
-            execute!(
2910
+            queue!(
29202911
                 self.stdout,
29212912
                 MoveTo(start_col as u16, row),
29222913
                 SetBackgroundColor(bg),
@@ -2933,7 +2924,7 @@ impl Screen {
29332924
         } else {
29342925
             format!("{} keybinds", keybinds.len())
29352926
         };
2936
-        execute!(
2927
+        queue!(
29372928
             self.stdout,
29382929
             MoveTo(start_col as u16, info_row),
29392930
             SetBackgroundColor(bg),
@@ -2948,7 +2939,7 @@ impl Screen {
29482939
         )?;
29492940
 
29502941
         // Draw bottom border
2951
-        execute!(
2942
+        queue!(
29522943
             self.stdout,
29532944
             MoveTo(start_col as u16, info_row + 1),
29542945
             SetBackgroundColor(bg),
@@ -2963,7 +2954,7 @@ impl Screen {
29632954
         } else {
29642955
             "↑↓:scroll  PgUp/PgDn:page  Home/End:jump  /:alt binds  Esc:close"
29652956
         };
2966
-        execute!(
2957
+        queue!(
29672958
             self.stdout,
29682959
             MoveTo(start_col as u16, info_row + 2),
29692960
             SetForegroundColor(Color::AnsiValue(243)),
@@ -2972,7 +2963,7 @@ impl Screen {
29722963
         )?;
29732964
 
29742965
         // Hide cursor when in modal
2975
-        execute!(self.stdout, Hide)?;
2966
+        queue!(self.stdout, Hide)?;
29762967
 
29772968
         self.stdout.flush()?;
29782969
         Ok(())
@@ -3015,7 +3006,7 @@ impl Screen {
30153006
 
30163007
         // Draw top border with title
30173008
         let title = format!(" References ({}) ", filtered.len());
3018
-        execute!(
3009
+        queue!(
30193010
             self.stdout,
30203011
             MoveTo(start_col as u16, start_row),
30213012
             SetBackgroundColor(bg),
@@ -3029,7 +3020,7 @@ impl Screen {
30293020
         )?;
30303021
 
30313022
         // Draw filter input row
3032
-        execute!(
3023
+        queue!(
30333024
             self.stdout,
30343025
             MoveTo(start_col as u16, start_row + 1),
30353026
             SetBackgroundColor(bg),
@@ -3047,7 +3038,7 @@ impl Screen {
30473038
         )?;
30483039
 
30493040
         // Draw separator
3050
-        execute!(
3041
+        queue!(
30513042
             self.stdout,
30523043
             MoveTo(start_col as u16, start_row + 2),
30533044
             SetBackgroundColor(bg),
@@ -3103,7 +3094,7 @@ impl Screen {
31033094
             // The remaining padding goes after line_info
31043095
             let remaining = panel_width.saturating_sub(max_path_width + line_info.len() + 4);
31053096
 
3106
-            execute!(
3097
+            queue!(
31073098
                 self.stdout,
31083099
                 MoveTo(start_col as u16, row),
31093100
                 SetBackgroundColor(item_bg),
@@ -3124,7 +3115,7 @@ impl Screen {
31243115
         let items_drawn = filtered.len().saturating_sub(scroll_offset).min(visible_rows);
31253116
         for i in items_drawn..visible_rows {
31263117
             let row = start_row + 3 + i as u16;
3127
-            execute!(
3118
+            queue!(
31283119
                 self.stdout,
31293120
                 MoveTo(start_col as u16, row),
31303121
                 SetBackgroundColor(bg),
@@ -3137,7 +3128,7 @@ impl Screen {
31373128
         // Draw help text row
31383129
         let help_row = start_row + 3 + visible_rows as u16;
31393130
         let help_text = "↑↓:nav  Enter:go  Esc:close";
3140
-        execute!(
3131
+        queue!(
31413132
             self.stdout,
31423133
             MoveTo(start_col as u16, help_row),
31433134
             SetBackgroundColor(bg),
@@ -3151,7 +3142,7 @@ impl Screen {
31513142
         )?;
31523143
 
31533144
         // Draw bottom border
3154
-        execute!(
3145
+        queue!(
31553146
             self.stdout,
31563147
             MoveTo(start_col as u16, help_row + 1),
31573148
             SetBackgroundColor(bg),
@@ -3161,7 +3152,7 @@ impl Screen {
31613152
         )?;
31623153
 
31633154
         // Hide cursor when in references panel
3164
-        execute!(self.stdout, Hide)?;
3155
+        queue!(self.stdout, Hide)?;
31653156
 
31663157
         self.stdout.flush()?;
31673158
         Ok(())
@@ -3194,7 +3185,7 @@ impl Screen {
31943185
         }
31953186
 
31963187
         // Top border
3197
-        execute!(
3188
+        queue!(
31983189
             self.stdout,
31993190
             MoveTo(start_col as u16, start_row),
32003191
             SetForegroundColor(Color::Cyan),
@@ -3205,7 +3196,7 @@ impl Screen {
32053196
         )?;
32063197
 
32073198
         // Header
3208
-        execute!(
3199
+        queue!(
32093200
             self.stdout,
32103201
             MoveTo(start_col as u16, start_row + 1),
32113202
             SetForegroundColor(Color::Cyan),
@@ -3218,7 +3209,7 @@ impl Screen {
32183209
         )?;
32193210
         let header_len = 25;
32203211
         let padding = panel_width - header_len - 7;
3221
-        execute!(
3212
+        queue!(
32223213
             self.stdout,
32233214
             Print(" ".repeat(padding)),
32243215
             Print("Alt+M"),
@@ -3228,7 +3219,7 @@ impl Screen {
32283219
         )?;
32293220
 
32303221
         // Header separator
3231
-        execute!(
3222
+        queue!(
32323223
             self.stdout,
32333224
             MoveTo(start_col as u16, start_row + 2),
32343225
             SetForegroundColor(Color::Cyan),
@@ -3245,7 +3236,7 @@ impl Screen {
32453236
             let row = start_row + 3 + i as u16;
32463237
             let is_selected = idx == panel.selected_index;
32473238
 
3248
-            execute!(
3239
+            queue!(
32493240
                 self.stdout,
32503241
                 MoveTo(start_col as u16, row),
32513242
                 SetForegroundColor(Color::Cyan),
@@ -3254,19 +3245,19 @@ impl Screen {
32543245
 
32553246
             // Highlight selected row
32563247
             if is_selected {
3257
-                execute!(self.stdout, SetAttribute(Attribute::Reverse))?;
3248
+                queue!(self.stdout, SetAttribute(Attribute::Reverse))?;
32583249
             }
32593250
 
32603251
             // Status icon
3261
-            execute!(self.stdout, Print(" "))?;
3252
+            queue!(self.stdout, Print(" "))?;
32623253
             if server.is_installed {
3263
-                execute!(
3254
+                queue!(
32643255
                     self.stdout,
32653256
                     SetForegroundColor(Color::Green),
32663257
                     Print("✓"),
32673258
                 )?;
32683259
             } else {
3269
-                execute!(
3260
+                queue!(
32703261
                     self.stdout,
32713262
                     SetForegroundColor(Color::Red),
32723263
                     Print("✗"),
@@ -3281,7 +3272,7 @@ impl Screen {
32813272
                 format!(" {} ({})", server.name, server.language)
32823273
             };
32833274
             let name_len = name_lang.len().min(panel_width - 20);
3284
-            execute!(
3275
+            queue!(
32853276
                 self.stdout,
32863277
                 SetForegroundColor(if is_installing { Color::Yellow } else { Color::White }),
32873278
                 Print(&name_lang[..name_len]),
@@ -3303,16 +3294,16 @@ impl Screen {
33033294
             let used = 1 + 1 + name_len + status.len() + 1;
33043295
             let content_width = panel_width - 2;
33053296
             let status_padding = content_width.saturating_sub(used);
3306
-            execute!(self.stdout, Print(" ".repeat(status_padding)))?;
3297
+            queue!(self.stdout, Print(" ".repeat(status_padding)))?;
33073298
 
33083299
             if server.is_installed {
3309
-                execute!(
3300
+                queue!(
33103301
                     self.stdout,
33113302
                     SetForegroundColor(Color::DarkGrey),
33123303
                     Print(status),
33133304
                 )?;
33143305
             } else {
3315
-                execute!(
3306
+                queue!(
33163307
                     self.stdout,
33173308
                     SetForegroundColor(Color::Yellow),
33183309
                     Print(status),
@@ -3320,10 +3311,10 @@ impl Screen {
33203311
             }
33213312
 
33223313
             if is_selected {
3323
-                execute!(self.stdout, SetAttribute(Attribute::Reset))?;
3314
+                queue!(self.stdout, SetAttribute(Attribute::Reset))?;
33243315
             }
33253316
 
3326
-            execute!(
3317
+            queue!(
33273318
                 self.stdout,
33283319
                 Print(" "),
33293320
                 SetForegroundColor(Color::Cyan),
@@ -3335,7 +3326,7 @@ impl Screen {
33353326
         // Fill remaining rows
33363327
         for i in (visible_end - panel.scroll_offset)..max_visible {
33373328
             let row = start_row + 3 + i as u16;
3338
-            execute!(
3329
+            queue!(
33393330
                 self.stdout,
33403331
                 MoveTo(start_col as u16, row),
33413332
                 SetForegroundColor(Color::Cyan),
@@ -3348,7 +3339,7 @@ impl Screen {
33483339
 
33493340
         // Footer separator
33503341
         let footer_row = start_row + 3 + max_visible as u16;
3351
-        execute!(
3342
+        queue!(
33523343
             self.stdout,
33533344
             MoveTo(start_col as u16, footer_row),
33543345
             SetForegroundColor(Color::Cyan),
@@ -3359,7 +3350,7 @@ impl Screen {
33593350
         )?;
33603351
 
33613352
         // Status or help
3362
-        execute!(
3353
+        queue!(
33633354
             self.stdout,
33643355
             MoveTo(start_col as u16, footer_row + 1),
33653356
             SetForegroundColor(Color::Cyan),
@@ -3388,18 +3379,18 @@ impl Screen {
33883379
                 msg.clone()
33893380
             };
33903381
             let display_width = msg_display.width();
3391
-            execute!(
3382
+            queue!(
33923383
                 self.stdout,
33933384
                 SetForegroundColor(Color::Yellow),
33943385
                 Print(format!(" {}", msg_display)),
33953386
             )?;
33963387
             // We printed 1 space + msg_display, need to fill to content_width
33973388
             let pad = content_width.saturating_sub(1 + display_width);
3398
-            execute!(self.stdout, Print(" ".repeat(pad)))?;
3389
+            queue!(self.stdout, Print(" ".repeat(pad)))?;
33993390
         } else {
34003391
             let help_text = " ↑↓ Navigate  Enter Install  r Refresh  Esc Close ";
34013392
             let help_width = help_text.width();
3402
-            execute!(
3393
+            queue!(
34033394
                 self.stdout,
34043395
                 SetForegroundColor(Color::DarkGrey),
34053396
                 Print(help_text),
@@ -3407,10 +3398,10 @@ impl Screen {
34073398
             // Content width is panel_width - 2 (for borders)
34083399
             let content_width = panel_width - 2;
34093400
             let pad = content_width.saturating_sub(help_width);
3410
-            execute!(self.stdout, Print(" ".repeat(pad)))?;
3401
+            queue!(self.stdout, Print(" ".repeat(pad)))?;
34113402
         }
34123403
 
3413
-        execute!(
3404
+        queue!(
34143405
             self.stdout,
34153406
             SetForegroundColor(Color::Cyan),
34163407
             Print("│"),
@@ -3418,7 +3409,7 @@ impl Screen {
34183409
         )?;
34193410
 
34203411
         // Bottom border
3421
-        execute!(
3412
+        queue!(
34223413
             self.stdout,
34233414
             MoveTo(start_col as u16, footer_row + 2),
34243415
             SetForegroundColor(Color::Cyan),
@@ -3446,7 +3437,7 @@ impl Screen {
34463437
         };
34473438
 
34483439
         // Top border
3449
-        execute!(
3440
+        queue!(
34503441
             self.stdout,
34513442
             MoveTo(start_col as u16, start_row),
34523443
             SetForegroundColor(Color::Cyan),
@@ -3458,7 +3449,7 @@ impl Screen {
34583449
 
34593450
         // Title
34603451
         let title = format!(" Install {}? ", server.name);
3461
-        execute!(
3452
+        queue!(
34623453
             self.stdout,
34633454
             MoveTo(start_col as u16, start_row + 1),
34643455
             SetForegroundColor(Color::Cyan),
@@ -3468,7 +3459,7 @@ impl Screen {
34683459
             SetAttribute(Attribute::Reset),
34693460
         )?;
34703461
         let pad = panel_width - 2 - title.len();
3471
-        execute!(
3462
+        queue!(
34723463
             self.stdout,
34733464
             Print(" ".repeat(pad)),
34743465
             SetForegroundColor(Color::Cyan),
@@ -3477,7 +3468,7 @@ impl Screen {
34773468
         )?;
34783469
 
34793470
         // Blank line
3480
-        execute!(
3471
+        queue!(
34813472
             self.stdout,
34823473
             MoveTo(start_col as u16, start_row + 2),
34833474
             SetForegroundColor(Color::Cyan),
@@ -3493,7 +3484,7 @@ impl Screen {
34933484
         } else {
34943485
             server.install_cmd.to_string()
34953486
         };
3496
-        execute!(
3487
+        queue!(
34973488
             self.stdout,
34983489
             MoveTo(start_col as u16, start_row + 3),
34993490
             SetForegroundColor(Color::Cyan),
@@ -3504,7 +3495,7 @@ impl Screen {
35043495
             Print(&cmd_display),
35053496
         )?;
35063497
         let pad = panel_width - 12 - cmd_display.len();
3507
-        execute!(
3498
+        queue!(
35083499
             self.stdout,
35093500
             Print(" ".repeat(pad)),
35103501
             SetForegroundColor(Color::Cyan),
@@ -3513,7 +3504,7 @@ impl Screen {
35133504
         )?;
35143505
 
35153506
         // Blank line
3516
-        execute!(
3507
+        queue!(
35173508
             self.stdout,
35183509
             MoveTo(start_col as u16, start_row + 4),
35193510
             SetForegroundColor(Color::Cyan),
@@ -3524,7 +3515,7 @@ impl Screen {
35243515
         )?;
35253516
 
35263517
         // Buttons
3527
-        execute!(
3518
+        queue!(
35283519
             self.stdout,
35293520
             MoveTo(start_col as u16, start_row + 5),
35303521
             SetForegroundColor(Color::Cyan),
@@ -3532,7 +3523,7 @@ impl Screen {
35323523
         )?;
35333524
         let button_text = "[Y]es    [N]o";
35343525
         let button_pad = (panel_width - 2 - button_text.len()) / 2;
3535
-        execute!(
3526
+        queue!(
35363527
             self.stdout,
35373528
             Print(" ".repeat(button_pad)),
35383529
             Print("["),
@@ -3551,7 +3542,7 @@ impl Screen {
35513542
         )?;
35523543
 
35533544
         // Bottom border
3554
-        execute!(
3545
+        queue!(
35553546
             self.stdout,
35563547
             MoveTo(start_col as u16, start_row + 6),
35573548
             SetForegroundColor(Color::Cyan),
@@ -3582,7 +3573,7 @@ impl Screen {
35823573
         let instructions = server.install_cmd.trim_start_matches('#').trim();
35833574
 
35843575
         // Top border
3585
-        execute!(
3576
+        queue!(
35863577
             self.stdout,
35873578
             MoveTo(start_col as u16, start_row),
35883579
             SetForegroundColor(Color::Cyan),
@@ -3594,7 +3585,7 @@ impl Screen {
35943585
 
35953586
         // Title
35963587
         let title = format!(" {} - Manual Installation ", server.name);
3597
-        execute!(
3588
+        queue!(
35983589
             self.stdout,
35993590
             MoveTo(start_col as u16, start_row + 1),
36003591
             SetForegroundColor(Color::Cyan),
@@ -3605,7 +3596,7 @@ impl Screen {
36053596
             SetAttribute(Attribute::Reset),
36063597
         )?;
36073598
         let pad = panel_width - 2 - title.len();
3608
-        execute!(
3599
+        queue!(
36093600
             self.stdout,
36103601
             Print(" ".repeat(pad)),
36113602
             SetForegroundColor(Color::Cyan),
@@ -3614,7 +3605,7 @@ impl Screen {
36143605
         )?;
36153606
 
36163607
         // Separator
3617
-        execute!(
3608
+        queue!(
36183609
             self.stdout,
36193610
             MoveTo(start_col as u16, start_row + 2),
36203611
             SetForegroundColor(Color::Cyan),
@@ -3625,7 +3616,7 @@ impl Screen {
36253616
         )?;
36263617
 
36273618
         // Language
3628
-        execute!(
3619
+        queue!(
36293620
             self.stdout,
36303621
             MoveTo(start_col as u16, start_row + 3),
36313622
             SetForegroundColor(Color::Cyan),
@@ -3636,7 +3627,7 @@ impl Screen {
36363627
             Print(server.language),
36373628
         )?;
36383629
         let lang_pad = panel_width - 13 - server.language.len();
3639
-        execute!(
3630
+        queue!(
36403631
             self.stdout,
36413632
             Print(" ".repeat(lang_pad)),
36423633
             SetForegroundColor(Color::Cyan),
@@ -3645,7 +3636,7 @@ impl Screen {
36453636
         )?;
36463637
 
36473638
         // Blank line
3648
-        execute!(
3639
+        queue!(
36493640
             self.stdout,
36503641
             MoveTo(start_col as u16, start_row + 4),
36513642
             SetForegroundColor(Color::Cyan),
@@ -3656,7 +3647,7 @@ impl Screen {
36563647
         )?;
36573648
 
36583649
         // Instructions label
3659
-        execute!(
3650
+        queue!(
36603651
             self.stdout,
36613652
             MoveTo(start_col as u16, start_row + 5),
36623653
             SetForegroundColor(Color::Cyan),
@@ -3664,7 +3655,7 @@ impl Screen {
36643655
             SetForegroundColor(Color::White),
36653656
             Print(" Installation:"),
36663657
         )?;
3667
-        execute!(
3658
+        queue!(
36683659
             self.stdout,
36693660
             Print(" ".repeat(panel_width - 16)),
36703661
             SetForegroundColor(Color::Cyan),
@@ -3681,7 +3672,7 @@ impl Screen {
36813672
             } else {
36823673
                 line.to_string()
36833674
             };
3684
-            execute!(
3675
+            queue!(
36853676
                 self.stdout,
36863677
                 MoveTo(start_col as u16, row),
36873678
                 SetForegroundColor(Color::Cyan),
@@ -3690,7 +3681,7 @@ impl Screen {
36903681
                 Print(format!("   {}", display_line)),
36913682
             )?;
36923683
             let line_pad = panel_width - 5 - display_line.len();
3693
-            execute!(
3684
+            queue!(
36943685
                 self.stdout,
36953686
                 Print(" ".repeat(line_pad)),
36963687
                 SetForegroundColor(Color::Cyan),
@@ -3702,7 +3693,7 @@ impl Screen {
37023693
         // Fill remaining instruction lines if less than 3
37033694
         for i in instr_lines.len()..3 {
37043695
             let row = start_row + 6 + i as u16;
3705
-            execute!(
3696
+            queue!(
37063697
                 self.stdout,
37073698
                 MoveTo(start_col as u16, row),
37083699
                 SetForegroundColor(Color::Cyan),
@@ -3714,7 +3705,7 @@ impl Screen {
37143705
         }
37153706
 
37163707
         // Blank line
3717
-        execute!(
3708
+        queue!(
37183709
             self.stdout,
37193710
             MoveTo(start_col as u16, start_row + 9),
37203711
             SetForegroundColor(Color::Cyan),
@@ -3725,7 +3716,7 @@ impl Screen {
37253716
         )?;
37263717
 
37273718
         // Status or help line
3728
-        execute!(
3719
+        queue!(
37293720
             self.stdout,
37303721
             MoveTo(start_col as u16, start_row + 10),
37313722
             SetForegroundColor(Color::Cyan),
@@ -3733,22 +3724,22 @@ impl Screen {
37333724
         )?;
37343725
 
37353726
         if panel.copied_to_clipboard {
3736
-            execute!(
3727
+            queue!(
37373728
                 self.stdout,
37383729
                 SetForegroundColor(Color::Green),
37393730
                 Print(" ✓ Copied to clipboard!"),
37403731
             )?;
3741
-            execute!(self.stdout, Print(" ".repeat(panel_width - 26)))?;
3732
+            queue!(self.stdout, Print(" ".repeat(panel_width - 26)))?;
37423733
         } else {
3743
-            execute!(
3734
+            queue!(
37443735
                 self.stdout,
37453736
                 SetForegroundColor(Color::DarkGrey),
37463737
                 Print(" [C] Copy to clipboard  [Esc] Close"),
37473738
             )?;
3748
-            execute!(self.stdout, Print(" ".repeat(panel_width - 38)))?;
3739
+            queue!(self.stdout, Print(" ".repeat(panel_width - 38)))?;
37493740
         }
37503741
 
3751
-        execute!(
3742
+        queue!(
37523743
             self.stdout,
37533744
             SetForegroundColor(Color::Cyan),
37543745
             Print("│"),
@@ -3756,7 +3747,7 @@ impl Screen {
37563747
         )?;
37573748
 
37583749
         // Bottom border
3759
-        execute!(
3750
+        queue!(
37603751
             self.stdout,
37613752
             MoveTo(start_col as u16, start_row + 11),
37623753
             SetForegroundColor(Color::Cyan),
@@ -3771,15 +3762,12 @@ impl Screen {
37713762
 
37723763
     /// Render the integrated terminal panel
37733764
     pub fn render_terminal(&mut self, terminal: &TerminalPanel, left_offset: u16) -> Result<()> {
3774
-        // Hide cursor during render to prevent flicker
3775
-        execute!(self.stdout, Hide)?;
3776
-
37773765
         let start_row = terminal.render_start_row(self.rows);
37783766
         let height = terminal.height;
37793767
         let terminal_width = self.cols.saturating_sub(left_offset) as usize;
37803768
 
37813769
         // Draw terminal border (top line with title)
3782
-        execute!(
3770
+        queue!(
37833771
             self.stdout,
37843772
             MoveTo(left_offset, start_row),
37853773
             SetBackgroundColor(Color::AnsiValue(237)),
@@ -3797,7 +3785,7 @@ impl Screen {
37973785
                 .unwrap_or_else(|| "Terminal".to_string());
37983786
             let title = format!(" {} ", name);
37993787
             let separator = "─".repeat(terminal_width.saturating_sub(title.len() + 2) / 2);
3800
-            execute!(
3788
+            queue!(
38013789
                 self.stdout,
38023790
                 Print(&separator),
38033791
                 SetAttribute(Attribute::Bold),
@@ -3811,7 +3799,7 @@ impl Screen {
38113799
             // Pad to end of line
38123800
             let printed = separator.chars().count() * 2 + title.len();
38133801
             if printed < terminal_width {
3814
-                execute!(self.stdout, Print(" ".repeat(terminal_width - printed)))?;
3802
+                queue!(self.stdout, Print(" ".repeat(terminal_width - printed)))?;
38153803
             }
38163804
         } else {
38173805
             // Multiple sessions: render tab bar
@@ -3838,14 +3826,14 @@ impl Screen {
38383826
 
38393827
                 // Set colors based on active state
38403828
                 if is_active {
3841
-                    execute!(
3829
+                    queue!(
38423830
                         self.stdout,
38433831
                         SetBackgroundColor(Color::AnsiValue(238)),
38443832
                         SetForegroundColor(Color::White),
38453833
                         SetAttribute(Attribute::Bold),
38463834
                     )?;
38473835
                 } else {
3848
-                    execute!(
3836
+                    queue!(
38493837
                         self.stdout,
38503838
                         SetBackgroundColor(Color::AnsiValue(235)),
38513839
                         SetForegroundColor(Color::AnsiValue(245)),
@@ -3857,7 +3845,7 @@ impl Screen {
38573845
                 let padding = tab_width.saturating_sub(tab_content.len());
38583846
                 let left_pad = padding / 2;
38593847
                 let right_pad = padding - left_pad;
3860
-                execute!(
3848
+                queue!(
38613849
                     self.stdout,
38623850
                     Print(" ".repeat(left_pad)),
38633851
                     Print(&tab_content),
@@ -3867,7 +3855,7 @@ impl Screen {
38673855
 
38683856
                 // Separator between tabs
38693857
                 if i < session_count - 1 {
3870
-                    execute!(
3858
+                    queue!(
38713859
                         self.stdout,
38723860
                         SetBackgroundColor(Color::AnsiValue(237)),
38733861
                         SetForegroundColor(Color::AnsiValue(240)),
@@ -3880,7 +3868,7 @@ impl Screen {
38803868
 
38813869
             // Fill remaining space
38823870
             if printed < available_width {
3883
-                execute!(
3871
+                queue!(
38843872
                     self.stdout,
38853873
                     SetBackgroundColor(Color::AnsiValue(237)),
38863874
                     SetForegroundColor(Color::White),
@@ -3902,14 +3890,14 @@ impl Screen {
39023890
         let mut current_underline = false;
39033891
 
39043892
         // Set initial colors
3905
-        execute!(
3893
+        queue!(
39063894
             self.stdout,
39073895
             SetBackgroundColor(default_bg),
39083896
             SetForegroundColor(default_fg)
39093897
         )?;
39103898
 
39113899
         for row in 0..(height - 1) {
3912
-            execute!(self.stdout, MoveTo(left_offset, start_row + 1 + row))?;
3900
+            queue!(self.stdout, MoveTo(left_offset, start_row + 1 + row))?;
39133901
 
39143902
             // Build a string of characters with same attributes to batch print
39153903
             let mut batch = String::new();
@@ -3946,30 +3934,30 @@ impl Screen {
39463934
                     if !batch.is_empty() {
39473935
                         // Apply batch attributes if different from current
39483936
                         if batch_fg != current_fg {
3949
-                            execute!(self.stdout, SetForegroundColor(batch_fg))?;
3937
+                            queue!(self.stdout, SetForegroundColor(batch_fg))?;
39503938
                             current_fg = batch_fg;
39513939
                         }
39523940
                         if batch_bg != current_bg {
3953
-                            execute!(self.stdout, SetBackgroundColor(batch_bg))?;
3941
+                            queue!(self.stdout, SetBackgroundColor(batch_bg))?;
39543942
                             current_bg = batch_bg;
39553943
                         }
39563944
                         if batch_bold != current_bold {
39573945
                             if batch_bold {
3958
-                                execute!(self.stdout, SetAttribute(Attribute::Bold))?;
3946
+                                queue!(self.stdout, SetAttribute(Attribute::Bold))?;
39593947
                             } else {
3960
-                                execute!(self.stdout, SetAttribute(Attribute::NoBold))?;
3948
+                                queue!(self.stdout, SetAttribute(Attribute::NoBold))?;
39613949
                             }
39623950
                             current_bold = batch_bold;
39633951
                         }
39643952
                         if batch_underline != current_underline {
39653953
                             if batch_underline {
3966
-                                execute!(self.stdout, SetAttribute(Attribute::Underlined))?;
3954
+                                queue!(self.stdout, SetAttribute(Attribute::Underlined))?;
39673955
                             } else {
3968
-                                execute!(self.stdout, SetAttribute(Attribute::NoUnderline))?;
3956
+                                queue!(self.stdout, SetAttribute(Attribute::NoUnderline))?;
39693957
                             }
39703958
                             current_underline = batch_underline;
39713959
                         }
3972
-                        execute!(self.stdout, Print(&batch))?;
3960
+                        queue!(self.stdout, Print(&batch))?;
39733961
                         batch.clear();
39743962
                     }
39753963
                     batch_fg = fg;
@@ -3983,38 +3971,37 @@ impl Screen {
39833971
             // Flush remaining batch for this row
39843972
             if !batch.is_empty() {
39853973
                 if batch_fg != current_fg {
3986
-                    execute!(self.stdout, SetForegroundColor(batch_fg))?;
3974
+                    queue!(self.stdout, SetForegroundColor(batch_fg))?;
39873975
                     current_fg = batch_fg;
39883976
                 }
39893977
                 if batch_bg != current_bg {
3990
-                    execute!(self.stdout, SetBackgroundColor(batch_bg))?;
3978
+                    queue!(self.stdout, SetBackgroundColor(batch_bg))?;
39913979
                     current_bg = batch_bg;
39923980
                 }
39933981
                 if batch_bold != current_bold {
39943982
                     if batch_bold {
3995
-                        execute!(self.stdout, SetAttribute(Attribute::Bold))?;
3983
+                        queue!(self.stdout, SetAttribute(Attribute::Bold))?;
39963984
                     } else {
3997
-                        execute!(self.stdout, SetAttribute(Attribute::NoBold))?;
3985
+                        queue!(self.stdout, SetAttribute(Attribute::NoBold))?;
39983986
                     }
39993987
                     current_bold = batch_bold;
40003988
                 }
40013989
                 if batch_underline != current_underline {
40023990
                     if batch_underline {
4003
-                        execute!(self.stdout, SetAttribute(Attribute::Underlined))?;
3991
+                        queue!(self.stdout, SetAttribute(Attribute::Underlined))?;
40043992
                     } else {
4005
-                        execute!(self.stdout, SetAttribute(Attribute::NoUnderline))?;
3993
+                        queue!(self.stdout, SetAttribute(Attribute::NoUnderline))?;
40063994
                     }
40073995
                     current_underline = batch_underline;
40083996
                 }
4009
-                execute!(self.stdout, Print(&batch))?;
3997
+                queue!(self.stdout, Print(&batch))?;
40103998
             }
40113999
         }
40124000
 
4013
-        // Position cursor in terminal (offset by left_offset)
4014
-        execute!(
4001
+        // Position cursor in terminal (offset by left_offset, but don't show - caller handles that)
4002
+        queue!(
40154003
             self.stdout,
40164004
             MoveTo(left_offset + cursor_col, start_row + 1 + cursor_row),
4017
-            Show,
40184005
             ResetColor
40194006
         )?;
40204007