TODO: * Finish C++ rewrite * Allow configuration of the default action (the one invoked when the user presses return).