static int SearchEndPos (int offset, MonoDevelop.SourceEditor.SourceEditorView view) { while (offset < view.TextEditor.Document.Length && view.TextEditor.Document.GetCharAt (offset).IsIdentifierPart ()) { offset++; } return offset; }
static bool IsMatchAt (MonoDevelop.SourceEditor.SourceEditorView view, int offset, string abbrevWord) { if (offset + abbrevWord.Length >= view.TextEditor.Document.Length) return false; if (offset > 0 && view.TextEditor.Document.GetCharAt (offset - 1).IsIdentifierPart ()) return false; if (offset + abbrevWord.Length < view.TextEditor.Document.Length && !view.TextEditor.Document.GetCharAt (offset + abbrevWord.Length).IsIdentifierPart ()) return false; return view.TextEditor.Document.GetTextAt (offset, abbrevWord.Length) == abbrevWord; }
static bool IsMatchAt(MonoDevelop.SourceEditor.SourceEditorView view, int offset, string abbrevWord) { if (offset + abbrevWord.Length >= view.TextEditor.Document.Length) { return(false); } if (offset > 0 && IsIdentifierPart(view.TextEditor.Document.GetCharAt(offset - 1))) { return(false); } if (offset + abbrevWord.Length < view.TextEditor.Document.Length && !IsIdentifierPart(view.TextEditor.Document.GetCharAt(offset + abbrevWord.Length))) { return(false); } return(view.TextEditor.Document.GetTextAt(offset, abbrevWord.Length) == abbrevWord); }
static void ReplaceWord(MonoDevelop.SourceEditor.SourceEditorView view, string curWord) { view.TextEditor.Replace(lastInsertPos, view.TextEditor.Caret.Offset - lastInsertPos, curWord); view.TextEditor.Document.CommitLineUpdate(view.TextEditor.Caret.Line); lastTriggerOffset = view.TextEditor.Caret.Offset = lastInsertPos + curWord.Length; }