Issue 3: Undo changes problem in code

Issue 3: Undo changes problem in code

The Undo changes is not working as I would expect it to work. There seems to be several problems with it. There is actually 3 problems when using the Undo changes in code.

Problem 1. It seems that when using the Undo. After pasting text to a unit. The Undo will not remove the text that was just pasted to the Unit. Instead the Undo will undo any changes made to another Unit file instead.

Problem 2. It seems that Scripter does not keep track of any changes made to any of the Unit files on a per file bases. And then only undoing only those changes made to the current Unit file. What I am seeing is that Scripter is keeping track of all the changes to all Unit files. And when you use the Undo to undo the changes to the current Unit file. It will remove the changes one change at a time. And if you keep using the Undo after all the changes have been undone. Scripter will start Undoing any changes still in its List for any other Unit file, in the Unit file that you are currently working with. Causing the code in the current Unit to become corrupt.

Problem 3. Now no matter if you are doing either problem 1 or 2. If you keep up with using the Undo option until all changes has been Undone. And then use the Undo again. This will cause multiple List index out of bounds errors to be displayed. In my case it was over 200+ List index out of bounds error messages being displayed.

To reproduce problem 1:

  1. Launch IDE Demo
  2. Replace the code in Unit1 with the code below.
  3. Select the Unit2 tab.
  4. Select the Code tab.
  5. Place the cursor at the end of Line 6
  6. Press Enter, cursor is not a empty Line 7.
  7. Select the Unit1 tab.
  8. Select Lines 13 thru 17.
  9. Press CTRL+C
  10. Select the Unit2 tab. The cursor should still be on the empty line 7.
  11. Press CTRL+V.
  12. Now Press CTRL+Z, or Select Edit > Undo from the menu.

To reproduce problem 2:

  1. Launch IDE Demo.
  2. Replace the code in Unit1 with the code below.
  3. Select the Unit2 tab
  4. Select the Code tab.
  5. Put the cursor at the end of line 6.
  6. Press CTRL+Z

To reproduce problem 3:

  1. Launch IDE Demo
  2. Edit Unit1 to match the code below. DO NOT COPY AND PAST THE CODE.
  3. Select the Unit2 tab
  4. Select the Code tab.
  5. Put the cursor at the end of line 6.
  6. Press CTRL+Z and just keep pressing CTRL+Z.

Test code for Unit1:

uses        
  Classes, Graphics, Controls, Forms, Dialogs,
  SysUtils, Unit2;

var
  MainForm: TForm2;
  i;
  
begin
  Application.ProcessMessages;
  MainForm := TForm2.Create(Application);
  try         
    MainForm.Show;
    for i := 1 to 60 do
    begin
      Application.ProcessMessages;
      Sleep(100);
    end;
  finally
    MainForm.Free;
  end;
end;

Thank you for the detailed report. We are able to reproduce and are investigating the issue.

This is now fixed in TMS Scripter 7.23 released today.

Thx for the update.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.