Convert to CMake, fix terminal resize behaviour

Fucking terminals, always broken in one way or another.

For future reference, libedit acts even worse than readline.