bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.28k stars 57 forks source link

[REQUEST] Handle other alphabets in input fields #152

Open jbaublitz opened 2 months ago

jbaublitz commented 2 months ago

Is your feature request related to a problem? Please describe. I was planning on using this for a terminal user interface for a flashcard app, but the text input doesn't seem to be able to display the Cyrillic or Arabic alphabet. I'm not sure if this is related to encoding or if there's a way to make the text inputs accept UTF-8, but currently those alphabets aren't displayed when you type them.

Describe the solution you'd like I'd like difference alphabets to be able to be displayed when typed into a text box.

Is this feature present in other TUI products? Yes.

Additional context Arabic might be a little bit hard to handle only because it goes right to left and is cursive, but Cyrillic is usually pretty easy to implement with simply UTF-8 encoding.

bczsalba commented 2 months ago

Does your terminal handle them correctly? I don't see any reason they shouldn't already work, IIRC emoji (mostly) do and those should be more complicated.

jbaublitz commented 2 months ago

Yes, my terminal does handle them correctly. Specifically the behavior I'm seeing is that when I type Cyrillic into the text input box, nothing is displayed.

bczsalba commented 2 months ago

If you run ptg -g and enter a cyrillic character, what does it output?

jbaublitz commented 2 months ago

This was the output.

PyTermGUI - Getch-practice/ ptg -g                  

┌────────────────────────────────────────────────┐
│                   Your output                  │
│                                                │
│ key                                   '\u0440' │
│ value:                                '\u0440' │
│ len()                                        1 │
│ real_length()                                1 │
└────────────────────────────────────────────────┘