adsr / mle

flexible terminal-based text editor (C)
Apache License 2.0
827 stars 53 forks source link

Alt (option) on Mac not working #81

Closed allestaire closed 1 year ago

allestaire commented 1 year ago

Tried to use this awesome tool for texteditor but seems like Alt key wont response on Mac OS

https://github.com/adsr/mle/assets/68372409/259e5591-870a-4e7d-920e-a42c57a6ecbe

mle version 1.7.2

allestaire commented 1 year ago

I guess this are the only accepted commands on alt - option (M)

This was run by mle -Qk

Screen Shot 2023-06-22 at 6 08 58 PM
allestaire commented 1 year ago

Got a solution to the problem,

Screen Shot 2023-06-22 at 9 40 27 PM Screen Shot 2023-06-22 at 9 41 24 PM
allestaire commented 1 year ago

Seems like shifts are not totally supported

Screen Shot 2023-06-22 at 10 08 44 PM
adsr commented 1 year ago

Hello, I don't have mac to test with at the moment, however I know the default settings on the macOS Terminal app do not emit all the usual escape codes. You already found one fix ("Use Option as Meta key"). For modified directional keys, you might try adding mappings for the following:

https://github.com/adsr/mle/blob/6f514a4e55d4d7ac3bce901bd188d1047e8f48e2/termbox2.h#L994-L1025

(Note "\x1b" is the hex equivalent of octal "\033". You may need to use the octal form for it to work.)

allestaire commented 1 year ago

Hello, I don't have mac to test with at the moment, however I know the default settings on the macOS Terminal app do not emit all the usual escape codes. You already found one fix ("Use Option as Meta key"). For modified directional keys, you might try adding mappings for the following:

https://github.com/adsr/mle/blob/6f514a4e55d4d7ac3bce901bd188d1047e8f48e2/termbox2.h#L994-L1025

(Note "\x1b" is the hex equivalent of octal "\033". You may need to use the octal form for it to work.)

Thanks for your response!! this helps me to test 😄