@@ -296,27 +296,26 @@ impl ConsoleRenderer {
296
296
297
297
// You can't have both ENABLE_WRAP_AT_EOL_OUTPUT and
298
298
// ENABLE_VIRTUAL_TERMINAL_PROCESSING. So we need to wrap manually.
299
- fn wrap_at_eol ( & mut self , s : & str , mut col : usize ) -> usize {
299
+ fn wrap_at_eol ( & mut self , s : & str , col : & mut usize ) {
300
300
let mut esc_seq = 0 ;
301
301
for c in s. graphemes ( true ) {
302
302
if c == "\n " {
303
- col = 0 ;
303
+ * col = 0 ;
304
304
self . buffer . push_str ( c) ;
305
305
} else {
306
306
let cw = width ( c, & mut esc_seq) ;
307
- col += cw;
308
- if col > self . cols {
307
+ * col += cw;
308
+ if * col > self . cols {
309
309
self . buffer . push ( '\n' ) ;
310
- col = cw;
310
+ * col = cw;
311
311
}
312
312
self . buffer . push_str ( c) ;
313
313
}
314
314
}
315
- if col == self . cols {
315
+ if * col == self . cols {
316
316
self . buffer . push ( '\n' ) ;
317
- col = 0 ;
317
+ * col = 0 ;
318
318
}
319
- col
320
319
}
321
320
}
322
321
@@ -357,21 +356,20 @@ impl Renderer for ConsoleRenderer {
357
356
new_layout : & Layout ,
358
357
highlighter : Option < & dyn Highlighter > ,
359
358
) -> Result < ( ) > {
360
- let default_prompt = new_layout. default_prompt ;
361
359
let cursor = new_layout. cursor ;
362
360
let end_pos = new_layout. end ;
363
361
let current_row = old_layout. cursor . row ;
364
362
let old_rows = old_layout. end . row ;
365
363
366
364
self . buffer . clear ( ) ;
367
365
let mut col = 0 ;
368
- add_prompt_and_highlight ( |s| { self . wrap_at_eol ( s, col) ; } ,
366
+ add_prompt_and_highlight ( |s| { self . wrap_at_eol ( s, & mut col) ; } ,
369
367
highlighter, line, prompt) ;
370
368
371
369
// append hint
372
370
if let Some ( hint) = hint {
373
371
if let Some ( highlighter) = highlighter {
374
- self . wrap_at_eol ( & highlighter. highlight_hint ( hint) , col) ;
372
+ self . wrap_at_eol ( & highlighter. highlight_hint ( hint) , & mut col) ;
375
373
} else {
376
374
self . buffer . push_str ( hint) ;
377
375
}
0 commit comments