Made automatic insertion one-step, rather than one character at a time

Fixed bug with invisible mode and newlines

some refactoring