magiblot / tvision

A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
Other
1.99k stars 150 forks source link

use opt-x in place of alt-x for macOS #100

Closed nuance1979 closed 1 year ago

nuance1979 commented 1 year ago

This PR fix the problem that Alt-X doesn't work on macOS.

magiblot commented 1 year ago

Hi!

Unfortunately, this doesn't work. Opt+X does not generate an special key combination that Turbo Vision can detect; it only produces an alternate character depending on your keyboard layout (similar to AltGr on Windows). In your case you were lucky that Opt+X produces the character, which can be represented as 0xF7 in CP437, and thus you were able to use a keycode constant that matches it. But, for example, this doesn't work for me with a Spanish keyboard layout.

The only solution for macOS is to use a terminal emulator that supports mapping some key to Alt/Meta. For example, the Terminal app has the "Use Option as Meta" setting, which will make Opt+X work like Alt+X:

Screenshot_20230425_092331

I hope that works for you.

nuance1979 commented 1 year ago

I see. Yes, "Use Option as Meta Key" works. I did not know that. Thanks for the tip!