Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Only print console input if character is printable #6378

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Conversation

claywar
Copy link
Contributor

@claywar claywar commented Oct 21, 2024

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

Console input appears to be handled one byte at a time, and certain keys such as arrow keys are two-byte inputs, where the first input is a non-printable character causing the print to choke. In the case of arrow keys, the initial byte sent is 224, followed by a second byte which is printable.

Moves print for input character to existing isprint() condition. This is not an elegant fix, as while the first character will be ignored, in the case of arrow keys the second byte will be added to the string. (Arrow keys, for example, will still print either H, P, K, or M)

Steps to test these changes

Start console, roll face on keyboard.

@claywar claywar merged commit 4a6b389 into base Oct 21, 2024
13 checks passed
@claywar claywar deleted the console-print branch October 21, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants