I update first post with new version, which includes keymap display screen (modifier+exit button) this screen is displayed while the key is pressed.
I have three test cases and they all have issues:
top - at exit it does not scroll, so the shell prompt displays on the last line of top.
htop - when a program with a short name is printed on a line where a program with a long name was, the remaining letters are displayed.
alpine - the keyboard command lines are not displayed on the bottom two rows, but one row above.
I do not even know if the problems come from line wrapping issues, unhandled escape sequence or a mishandled escape sequence. If anyone has an idea, or a simpler test case,