When using Mail in OS X Yosemite, you might run into an issue where the program will move the cursor back a few characters whenever you type certain punctuation marks, and sometimes even delete a few characters whenever you enter these marks. This issue has its obvious frustrations, but luckily the fix is relatively straightforward.
The problem here revolves around Apple’s implementation of spell check and auto correct, where as you type Mail will detect misspelled words and either underline them, or in some cases substitute words automatically as you type.
While the behavior of this feature should follow the rules and settings you have saved in both the Text section of the Keyboard system preferences, and in the application-specific settings for Mail, it appears some conflict with these may be the root of this cursor movement issue, and can be fixed by toggling relevant autocorrect and spell check settings.
Next go to the Edit > Substitutions menu and uncheck all of the substitution options. If the problem stops, then re-enable them one-by-one to see if any results in the problem, and then only disable that substitution option.
Finally, try going to the Apple menu and choosing System Preferences. In here, go to the Text section of the Keyboard system preferences, where you will see a list of custom auto-corrections and spelling settings. If you have any substitutions listed with a text string in the “Replace” column but with an empty string in the “With” column, then remove this entry as it will automatically delete the words you enter. In addition, try using the spelling settings to disable spelling services, and choose a specific (and relevant) language for spell checking.
Beyond these issues, this problem may be related to a similar one caused by odd character encodings used in Mail, so you might follow the instructions in this past article to ensure your Mail text encoding is correct.