File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,8 +114,6 @@ impl TerminalBuffer {
114114 * cell = ' ' ;
115115 }
116116 } ) ;
117- self . cursor_row = 0 ;
118- self . cursor_col = 0 ;
119117 }
120118
121119 fn clear_to_end ( & mut self ) {
@@ -216,19 +214,19 @@ impl Perform for TerminalBuffer {
216214 self . cursor_col = col. min ( self . width . saturating_sub ( 1 ) ) ;
217215 }
218216 'A' => {
219- let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) as usize ;
217+ let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) . max ( 1 ) as usize ;
220218 self . cursor_row = self . cursor_row . saturating_sub ( amount) ;
221219 }
222220 'B' => {
223- let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) as usize ;
221+ let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) . max ( 1 ) as usize ;
224222 self . cursor_row = ( self . cursor_row + amount) . min ( self . height . saturating_sub ( 1 ) ) ;
225223 }
226224 'C' => {
227- let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) as usize ;
225+ let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) . max ( 1 ) as usize ;
228226 self . cursor_col = ( self . cursor_col + amount) . min ( self . width . saturating_sub ( 1 ) ) ;
229227 }
230228 'D' => {
231- let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) as usize ;
229+ let amount = params. first ( ) . copied ( ) . unwrap_or ( 1 ) . max ( 1 ) as usize ;
232230 self . cursor_col = self . cursor_col . saturating_sub ( amount) ;
233231 }
234232 'm' => self . handle_sgr ( & params) ,
You can’t perform that action at this time.
0 commit comments