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

Prevent C0 control codes #38

Merged
merged 1 commit into from
Aug 4, 2023
Merged

Prevent C0 control codes #38

merged 1 commit into from
Aug 4, 2023

Conversation

jessarcher
Copy link
Member

This PR fixes an issue where pressing keys like Ctrl+A, Ctrl+B, etc. while in a text field would capture non-printable control codes.

In addition to returning these codes, it would also impact the box drawing because the characters would be counted for padding but not visually take up any space:

image

I previously maintained an ignore list to deal with the most common ones, but now that I better understand the problem, we can safely exclude any characters with an ordinal code point less than 32.

See https://en.wikipedia.org/wiki/C0_and_C1_control_codes and https://en.wikipedia.org/wiki/List_of_Unicode_characters

There are other potentially problematic control codes in the C1 range and elsewhere, but they're not easy to input in everyday use with the keyboard.

@taylorotwell taylorotwell merged commit aecf6f3 into main Aug 4, 2023
@taylorotwell taylorotwell deleted the prevent-control-codes branch August 4, 2023 14:26
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.

2 participants