/// <remarks>Removes the selected text from the buffer and clears the selection.</remarks> public void RemoveSelectedText() { if (_document.ReadOnly) { ClearSelection(); return; } List <int> lines = new List <int>(); int offset = -1; bool oneLine = true; if (oneLine) { int lineBegin = StartPosition.Y; if (lineBegin != EndPosition.Y) { oneLine = false; } else { lines.Add(lineBegin); } } offset = StartOffset; _document.Remove(StartOffset, Length); ClearSelection(); if (offset >= 0) { // document.Caret.Offset = offset; // original } if (offset != -1) { if (oneLine) { foreach (int i in lines) { _document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, i)); } } else { _document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); } _document.CommitUpdate(); } }