Handle keyUp and keyDown instead of synthetic insertNewline to get control over inserted chars. Cancel inserting \n.