Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static void CanDelete(object target, CanExecuteRoutedEventArgs args)
// HasSomethingSelected for delete command
TextArea textArea = GetTextArea(target);
if (textArea != null && textArea.Document != null) {
args.CanExecute = !textArea.Selection.IsEmpty;
args.CanExecute = !textArea.Selection.IsEmpty && textArea.ReadOnlySectionProvider.CanInsert(textArea.Caret.Offset);
args.Handled = true;
}
}
Expand All @@ -291,7 +291,7 @@ static void CanCutOrCopy(object target, CanExecuteRoutedEventArgs args)
// HasSomethingSelected for copy and cut commands
TextArea textArea = GetTextArea(target);
if (textArea != null && textArea.Document != null) {
args.CanExecute = textArea.Options.CutCopyWholeLine || !textArea.Selection.IsEmpty;
args.CanExecute = (textArea.Options.CutCopyWholeLine || !textArea.Selection.IsEmpty) && (args.Command != ApplicationCommands.Cut || textArea.ReadOnlySectionProvider.CanInsert(textArea.Caret.Offset));
args.Handled = true;
}
}
Expand Down