static int DeleteWordBeforeCaret (MonoDevelop.Ide.Gui.TextEditor editor) { int offset = editor.CursorPosition; int start = FindPrevWordStart (editor, offset); editor.DeleteText (start, offset - start); return start; }