Recent

Author Topic: [BUG?] The first paste operation is different from the other paste  (Read 1596 times)

tomitomy

  • Sr. Member
  • ****
  • Posts: 251
When I tested my Undo Redo function, I found this problem, it looks like a BUG, some people encountered such a problem?

Before using Cut or Copy, using the Paste operation will result in the lack of timely access to the pasted content:
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   TForm1 = class(TForm)
  13.     bttnCopy: TButton;
  14.     bttnPaste: TButton;
  15.     bttnCut: TButton;
  16.     Memo1: TMemo;
  17.     procedure bttnCopyClick(Sender: TObject);
  18.     procedure bttnCutClick(Sender: TObject);
  19.     procedure bttnPasteClick(Sender: TObject);
  20.     procedure FormCreate(Sender: TObject);
  21.   private
  22.   public
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.lfm}
  31.    
  32. procedure TForm1.FormCreate(Sender: TObject);
  33. begin
  34.   Memo1.Text := 'ABCD';
  35. end;
  36.  
  37. procedure TForm1.bttnCopyClick(Sender: TObject);
  38. begin
  39.   Memo1.CopyToClipboard;
  40. end;
  41.  
  42. procedure TForm1.bttnCutClick(Sender: TObject);
  43. begin              
  44.   writeln('Before Cut: ', Memo1.Text);
  45.   Memo1.CutToClipboard;  
  46.   writeln('After  Cut: ', Memo1.Text);
  47. end;
  48.  
  49. procedure TForm1.bttnPasteClick(Sender: TObject);
  50. begin
  51.   writeln('Before Paste: ', Memo1.Text);
  52.   Memo1.PasteFromClipboard;
  53.   writeln('After  Paste: ', Memo1.Text);
  54. end;
  55.  
  56. end.

I did the tests in Linux Mint 18.2 Mate, using Lazarus 1.8.0RC4 and 1.9.0(svn 56537M) GTK2

Is this a Bug?
« Last Edit: December 04, 2017, 01:11:57 pm by tomitomy »

 

TinyPortal © 2005-2018