Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Console][WIP][POC] Add support for arrow keys in QuestionHelper#36700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

pierredup
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#36657
LicenseMIT
Doc PRTBD

Add support for using arrow keys in the QuestionHelper.

The approach here does not depend onreadline at all (which had some issues and was removed in#17669)

This PR also solves some of the issues experienced by@javiereguiluz in#15583, as well as supports decorated messages (which readline doesn't, as per#16458 (comment)).

Before I finish the PR, I just want to get some feedback first if this approach is acceptable.

TODO:

  • Fix current tests
  • Add new tests
  • Support arrow keys when question is autocompleted

Chi-teck reacted with thumbs up emoji
Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't understand the internals of this, so I can't really review it ... but I hope we can fix it this time. It would be great! Thanks@pierredup.

sstok and obstschale reacted with rocket emoji
throw new MissingInputException('Aborted.');
}

$k = \ord($ret);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

To make this code maintainable in the future, we could rename some variables. E.g.$k ->$pressedKey or$keyCode,etc.

chapterjason and obstschale reacted with thumbs up emoji
$k = \ord(fgetc($inputStream));

switch (true) {
case 67 === $k && $pos < self::strlen($string):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please, let's define some constants to avoid these "magic numbers". E.g.:

caseself::ARROW_RIGHT ===$pressedKey:// ...caseself::ARROW_LEFT ===$pressedKey:// ...// ...

sstok and obstschale reacted with thumbs up emoji

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would highly appreciate that. I read the code and it took some time to dechipher what these numbers are.

@nicolas-grekasnicolas-grekas added this to thenext milestoneMay 5, 2020
@fabpot
Copy link
Member

Closing as this PR has been in a draft state for many months. Feel free to reopen when it's ready for review.

obstschale reacted with confused emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@obstschaleobstschaleobstschale left review comments

Assignees
No one assigned
Projects
None yet
Milestone
5.2
Development

Successfully merging this pull request may close these issues.

Console: Support Left/Right Arrow Keys
6 participants
@pierredup@fabpot@javiereguiluz@obstschale@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp