How to detect if a keypress is ESC in ncurses?
I have asked chatgpt, it said this can do it:
if (key_defined(ch) && key_name(ch)[0] == '^')
But this is not 100% portable way.
ESC keycode equal to 27 in ASCII, and it may have other value in others coding standards. So Is there a portable way to determine this?