private static bool SearchNextSectionOrPerform(string sectionName, int offset) { var editor = new ScintillaGateway(PluginBase.GetCurrentScintilla()); using (TextToFind textToFind = new TextToFind(offset, editor.GetTextLength() - 1, sectionName)) { Position sectionPosition = editor.FindText(0, textToFind); if (sectionPosition.Value >= 0) { if (editor.GetLine(editor.LineFromPosition(sectionPosition)).StartsWith("*")) { CurrentSearchOffset = sectionPosition.Value + sectionName.Length; return(SearchNextSectionOrPerform(sectionName, CurrentSearchOffset)); } ScrollToLine(editor.LineFromPosition(sectionPosition)); CurrentSearchOffset = sectionPosition.Value + sectionName.Length; return(true); } else { return(false); } } }
/// <summary> /// Gets all text of the current document. /// </summary> static public string GetAllText(this ScintillaGateway scintilla) => scintilla.GetText(scintilla.GetTextLength() + 1);