File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ pub struct Editor {
129129 /// Accumulated text for ex insert mode.
130130 ex_insert_text : Vec < String > ,
131131 /// Whether running in headless mode (for testing).
132+ #[ allow( dead_code) ]
132133 headless : bool ,
133134}
134135
Original file line number Diff line number Diff line change @@ -125,17 +125,16 @@ impl Terminal {
125125 return Ok ( TerminalSize :: default ( ) ) ;
126126 }
127127
128- // Validate and clamp values to safe bounds to protect against
129- // malformed terminal responses that could cause division by zero
130- // or excessive memory allocation
131- let rows = ws. ws_row . clamp ( Self :: MIN_ROWS , Self :: MAX_ROWS ) ;
132- let cols = ws. ws_col . clamp ( Self :: MIN_COLS , Self :: MAX_COLS ) ;
133-
134- // If values were zero or invalid, use defaults
128+ // If values are zero or invalid, use defaults
135129 if ws. ws_row == 0 || ws. ws_col == 0 {
136130 return Ok ( TerminalSize :: default ( ) ) ;
137131 }
138132
133+ // Clamp values to safe bounds to protect against
134+ // excessive memory allocation from malformed terminal responses
135+ let rows = ws. ws_row . clamp ( Self :: MIN_ROWS , Self :: MAX_ROWS ) ;
136+ let cols = ws. ws_col . clamp ( Self :: MIN_COLS , Self :: MAX_COLS ) ;
137+
139138 Ok ( TerminalSize { rows, cols } )
140139 }
141140 }
You can’t perform that action at this time.
0 commit comments