private static void FormatRtf() { IntPtr currentScint = PluginBase.GetCurrentScintilla(); ScintillaGateway scintillaGateway = new ScintillaGateway(currentScint); string allText = scintillaGateway.GetAllText(); if (!IsTextRtf(allText)) { return; } string newText = rtfFormatter.GetFormattedText(allText); if (allText != newText) { scintillaGateway.SetText(newText); } }