Parcourir la source

Fix copy, paste from Windows to DosBox-X/DOS (target go32v2).

Margers il y a 2 semaines
Parent
commit
f3cb37a5e1
1 fichiers modifiés avec 15 ajouts et 3 suppressions
  1. 15 3
      packages/ide/winclip.pas

+ 15 - 3
packages/ide/winclip.pas

@@ -43,7 +43,7 @@ implementation
 
 {$ifdef linux}
   uses
-    baseUnix,base64,keyboard,Objects,fvclip;
+    baseUnix,keyboard,fvclip;
 {$endif linux}
 
 {$ifdef Windows}
@@ -415,6 +415,7 @@ var
 {$ifdef DOS}
   r : Registers;
   M : MemPtr;
+  pp: PAnsiChar;
 {$endif DOS}
 {$ifdef linux}
   rez : boolean; {one variable needed to satisfy compiler}
@@ -444,7 +445,7 @@ begin
       CloseWinClipBoard;
       exit;
     end;
-  GetMem(p,l);
+  GetMem(p,l+1);
   GetDosMem(M,l);
   r.ax:=$1705;
   r.dx:=7{ OEM Text rather then 1 : Text };
@@ -502,6 +503,8 @@ begin
 {$ifdef DOS}
   M.MoveDataFrom(l,P^);
   FreeDosMem(M);
+  pp:=p+l;
+  pp^:=#0; { make null terminated }
 {$endif DOS}
 end;
 
@@ -510,6 +513,8 @@ var
 {$ifdef DOS}
   r : Registers;
   M : MemPtr;
+  pp: PAnsiChar;
+  op: PAnsiChar;
 {$endif DOS}
 {$ifdef linux}
   st : AnsiString;
@@ -536,8 +541,13 @@ begin
     exit;
   EmptyWinClipBoard;
 {$ifdef DOS}
+  GetMem(pp,l+1);
+  Move(p^,pp^,l);
+  op:=pp+l;
+  op^:=#0; { make sure that string is null terminated }
   GetDosMem(M,l+1);
-  M.MoveDataTo(P^,l+1);
+  M.MoveDataTo(PP^,l+1);
+  FreeMem(pp);
   r.ax:=$1703;
   r.dx:=7{ OEM Text rather then 1 : Text };
   r.es:=M.DosSeg;
@@ -546,6 +556,7 @@ begin
   r.cx:=l and $ffff;
   RealIntr($2F,r);
   SetTextWinClipBoardData:=(r.ax<>0);
+  (*
   r.ax:=$1703;
   r.dx:=1{ Empty  Text };
   r.es:=M.DosSeg;
@@ -553,6 +564,7 @@ begin
   r.si:=0;
   r.cx:=0;
   RealIntr($2F,r);
+  *)
   FreeDosMem(M);
 {$endif DOS}
 {$ifdef linux}