Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SynEdit: open and close clipboard explicitly to write multiple formats.

git-svn-id: http://svn.freepascal.org/svn/lazarus/trunk@37705 4005530d-fff6-0310-9dd1-cebe43e6787f
  • Loading branch information...
commit 3d10d086ec60e600625ea9d6de3ff3da2adb725a 1 parent ae45576
martin authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 components/synedit/syneditmiscclasses.pp
17 components/synedit/syneditmiscclasses.pp
View
@@ -1285,12 +1285,19 @@ function TSynClipboardStream.ReadFromClipboard(AClipboard: TClipboard): Boolean;
function TSynClipboardStream.WriteToClipboard(AClipboard: TClipboard): Boolean;
begin
- if FIsPlainText and (FText <> '') then begin
- AClipboard.AsText:= FText;
- if not AClipboard.HasFormat(CF_TEXT) then
- raise ESynEditError.Create('Clipboard copy operation failed: HasFormat');
+ AClipboard.Open;
+ try
+ if FIsPlainText and (FText <> '') then begin
+ AClipboard.AsText:= FText;
+ end;
+ Result := AClipboard.AddFormat(ClipboardFormatId, FMemStream.Memory^, FMemStream.Size);
+ finally
+ AClipboard.Close;
end;
- Result := AClipboard.AddFormat(ClipboardFormatId, FMemStream.Memory^, FMemStream.Size);
+ {$IFDEF SynClipboardExceptions}
+ if not AClipboard.HasFormat(CF_TEXT) then
+ raise ESynEditError.Create('Clipboard copy operation failed: HasFormat');
+ {$ENDIF}
end;
procedure TSynClipboardStream.Clear;
Please sign in to comment.
Something went wrong with that request. Please try again.