Another attempt at supporting ncurses6
Note that I have absolutely no idea what I'm doing here. I looked at some doc and came up with something that seems to work with ncurses6 (current main doesn't compile for me). Please see if it makes any sense.