protected override void Run() { var count = Math.Min(Math.Max(Count, 1), Editor.GetLine(Editor.Caret.Line).EndOffset - Editor.Caret.Offset); Editor.SetSelection(Editor.Caret.Offset, Editor.Caret.Offset + count); ClipboardActions.Copy(Editor); var stuff = ClipboardActions.GetClipboardContent(); var swapped = new string(stuff.Select(c => char.IsLetter(c) ? char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c) : c).ToArray()); Editor.SetSelection(Editor.Caret.Offset, Editor.Caret.Offset + count); Editor.InsertAtCaret(swapped); }
bool ClipboardContainsSelection() { return(textEditor.SelectedText == ClipboardActions.GetClipboardContent()); }