Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Class Completion    [ Add a report in this area ]  
Report #:  106793   Status: Open
Ctrl-Shift-C to copy method from type to code inserts the method begin/end between other method's "end;" statement  and a comment following it
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Robert Frank
Report Type:  Basic functionality failure Date Reported:  6/29/2012 5:31:41 PM
Severity:    Commonly encountered problem Last Updated: 7/2/2012 10:28:51 PM
Platform:    All versions Internal Tracking #:  
Resolution: Duplicate (Resolution Comments) Resolved in Build: : None
Duplicate of:  602
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
If you type a public or private method declaration into an object, and then hit Ctrl-Shift-C, the method (ie. Procedure TForm1.MyMethod; begin end) is inserted between some other method's "end;" statement and any comment following it on the same line.

Before:
---------
Procedure TForm1.Button1Click( Sender: TObject);
begin
end; { This is a comment on the last line of Button1Click }
---------

After:
---------
Procedure TForm1.Button1Click( Sender: TObject);
begin
end;

Procedure TForm1.MyMethod
begin
end;

{ This is a comment on the last line of Button1Click }  <--- This comment should be on the final end; of Button1Click.
---------

This bug has been around for years and years. It's a real nusiance.
Steps to Reproduce:
1. Create a method that has a comment on it's last line:
---------
Procedure TForm1.Button1Click( Sender: TObject);
begin
end; { This is a comment on the last line of Button1Click }
---------

2. Type a new method declaration into the declaration of an object:
---------
  Form1 = class(TObject)
  Procedure Button1Click( Sender: TObject)
  private
  public
     Procedure MyMethod;  <--- add this line
  end;
---------

3. Put the cursor on MyMethod and hit Ctrl-Shift-C
---------
Procedure TForm1.Button1Click( Sender: TObject);
begin
end;

Procedure TForm1.MyMethod
begin
end;

{ This is a comment on the last line of Button1Click }  <--- This comment should be on the final end; of Button1Click.
---------
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 6/30/2012 7:04:08 PM -
Is this issue same as QC#602 ?

Server Response from: ETNACODE01