Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d67c7ea

Browse filesBrowse files
committed
[Console] Fix autocomplete multibyte input support
1 parent 814bdeb commit d67c7ea
Copy full SHA for d67c7ea

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/QuestionHelper.php
+3-3Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.