diff --git a/Components/ScintEdit.pas b/Components/ScintEdit.pas index 7148076bc..fc7e8f9fa 100644 --- a/Components/ScintEdit.pas +++ b/Components/ScintEdit.pas @@ -254,6 +254,7 @@ TScintEdit = class(TWinControl) procedure CancelAutoComplete; procedure CancelAutoCompleteAndCallTip; procedure CancelCallTip; + function CanPaste: Boolean; function CanRedo: Boolean; function CanUndo: Boolean; procedure ChooseCaretX; @@ -712,6 +713,11 @@ procedure TScintEdit.CancelCallTip; Call(SCI_CALLTIPCANCEL, 0, 0); end; +function TScintEdit.CanPaste: Boolean; +begin + Result := Call(SCI_CANPASTE, 0, 0) <> 0; +end; + function TScintEdit.CanRedo: Boolean; begin Result := Call(SCI_CANREDO, 0, 0) <> 0; diff --git a/Projects/Src/IDE.MainForm.pas b/Projects/Src/IDE.MainForm.pas index 2ee6c315d..2f58c8ebc 100644 --- a/Projects/Src/IDE.MainForm.pas +++ b/Projects/Src/IDE.MainForm.pas @@ -1429,7 +1429,7 @@ procedure TMainForm.MemoKeyDown(Sender: TObject; var Key: Word; end; end; end else if ((Key = Ord('V')) or (Key = VK_INSERT)) and (Shift * [ssShift, ssAlt, ssCtrl] = [ssCtrl]) then begin - if not FActiveMemo.ReadOnly and Clipboard.HasFormat(CF_TEXT) then { Also see EMenuClick } + if FActiveMemo.CanPaste then if MultipleSelectionPasteFromClipboard(FActiveMemo) then Key := 0; end else if (Key = VK_SPACE) and (Shift * [ssShift, ssAlt, ssCtrl] = [ssShift, ssCtrl]) then begin @@ -2864,7 +2864,7 @@ procedure TMainForm.EMenuClick(Sender: TObject); ERedo.Enabled := MemoHasFocus and FActiveMemo.CanRedo; ECut.Enabled := MemoHasFocus and not MemoIsReadOnly and not FActiveMemo.SelEmpty; ECopy.Enabled := MemoHasFocus and not FActiveMemo.SelEmpty; - EPaste.Enabled := MemoHasFocus and not MemoIsReadOnly and Clipboard.HasFormat(CF_TEXT); { Also see MemoKeyDown } + EPaste.Enabled := MemoHasFocus and FActiveMemo.CanPaste; EDelete.Enabled := MemoHasFocus and not FActiveMemo.SelEmpty; ESelectAll.Enabled := MemoHasFocus; ESelectNextOccurrence.Enabled := MemoHasFocus;