[Python condole] Don't insert '\n' char if cursor is not located in input area.
Document and some code cleanups.