@@ -236,7 +236,7 @@ protected function writeError(OutputInterface $output, \Exception $error)
236
236
*/
237
237
private function autocomplete (OutputInterface $ output , Question $ question , $ inputStream , callable $ autocomplete ): string
238
238
{
239
- $ cursor = new Cursor ($ output );
239
+ $ cursor = new Cursor ($ output, $ inputStream );
240
240
241
241
$ fullChoice = '' ;
242
242
$ ret = '' ;
@@ -265,7 +265,6 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
265
265
} elseif ("\177" === $ c ) { // Backspace Character
266
266
if (0 === $ numMatches && 0 !== $ i ) {
267
267
--$ i ;
268
- // Move cursor backwards
269
268
$ cursor ->moveLeft ();
270
269
271
270
$ fullChoice = self ::substr ($ fullChoice , 0 , $ i );
@@ -354,16 +353,13 @@ function ($match) use ($ret) {
354
353
}
355
354
}
356
355
357
- // Erase characters from cursor to end of line
358
356
$ cursor ->clearLine (true );
359
357
360
358
if ($ numMatches > 0 && -1 !== $ ofs ) {
361
- // Save cursor position
362
359
$ cursor ->savePosition ();
363
360
// Write highlighted text, complete the partially entered response
364
361
$ charactersEntered = \strlen (trim ($ this ->mostRecentlyEnteredValue ($ fullChoice )));
365
362
$ output ->write ('<hl> ' .OutputFormatter::escapeTrailingBackslash (substr ($ matches [$ ofs ], $ charactersEntered )).'</hl> ' );
366
- // Restore cursor position
367
363
$ cursor ->restorePosition ();
368
364
}
369
365
}
0 commit comments