[WIP] "abstract_ui" fixes and improvements

FWIW I noticed these things while prototyping a UI in python
Assuming that the function `find_special_key()` in `trans_special()` can return any values vor `key` and `modifiers`, `trans_special()` could write up to 9 bytes into `buf` (3 bytes for modifiers and 6 bytes for an utf8 key). Can there be such an input sequence?