Fixed character inserted to wrong place when inserting on a newline marker.