8000 [Console] Fix autocomplete multibyte input support · symfony/symfony@d67c7ea · GitHub
[go: up one dir, main page]

Skip to content

Commit d67c7ea

Browse files
committed
[Console] Fix autocomplete multibyte input support
1 parent 814bdeb commit d67c7ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
264264
} elseif ("\177" === $c) { // Backspace Character
265265
if (0 === $numMatches && 0 !== $i) {
266266
--$i;
267-
$fullChoice = substr($fullChoice, 0, -1);
267+
$fullChoice = mb_substr($fullChoice, 0, -1);
268268
// Move cursor backwards
269269
$output->write("\033[1D");
270270
}
@@ -278,7 +278,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
278278
}
279279

280280
// Pop the last character off the end of our string
281-
$ret = substr($ret, 0, $i);
281+
$ret = mb_substr($ret, 0, $i);
282282
} elseif ("\033" === $c) {
283283
// Did we read an escape sequence?
284284
$c .= fread($inputStream, 2);
@@ -304,7 +304,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
304304
$remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
305305
$output->write($remainingCharacters);
306306
$fullChoice .= $remainingCharacters;
307-
$i = \strlen($fullChoice);
307+
$i = mb_strlen($fullChoice);
308308
}
309309

310310
if ("\n" === $c) {

0 commit comments

Comments
 (0)
0