Browse Source

Fixed bug in EditingCommandHandler.Cut that allowed deleting read-only text.

4.0
Daniel Grunwald 15 years ago
parent
commit
441fd15488
  1. 5
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs

5
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs

@ -300,7 +300,10 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -300,7 +300,10 @@ namespace ICSharpCode.AvalonEdit.Editing
if (textArea.Selection.IsEmpty && textArea.Options.CutCopyWholeLine) {
DocumentLine currentLine = textArea.Document.GetLineByNumber(textArea.Caret.Line);
CopyWholeLine(textArea, currentLine);
textArea.Document.Remove(currentLine.Offset, currentLine.TotalLength);
ISegment[] segmentsToDelete = textArea.GetDeletableSegments(new SimpleSegment(currentLine.Offset, currentLine.TotalLength));
for (int i = segmentsToDelete.Length - 1; i >= 0; i--) {
textArea.Document.Remove(segmentsToDelete[i]);
}
} else {
CopySelectedText(textArea);
textArea.RemoveSelectedText();

Loading…
Cancel
Save