completion works slightly better after readline.get_line_buffer() is used instead of function's input parameter. We need to work on commands.choices_left though, and most certainly get rid of linebreak character as EOL symbol in command syntax tree.