fix ctrl+enter bug when caretposition is not in the end
parens and brackets will automatically be closed