More Issues with Scripter 7.23 and newer.

Well, I had found a couple more issues with scripter. But the issues are only in v7.23 and newer.

To reproduce both issues in Scripter IDE Demo please follow the following:

  1. Open the Scripter Studio Pro IDE Demo project into your IDE.
  2. Double Click on the PopupMenu1 VCL icon to open the Menu Designer.
  3. Add a new Menu Item at the bottom of the list. And give it the name Test1 and change the Caption to Test.
  4. Create a OnClick event for the new Menu Item.
  5. Load the OnClick event with the following code:
procedure TForm1.Test1Click(Sender: TObject);
var
  tmpStr: String;
begin
  with IDEEngine1 do
  begin
    with Memo do
    begin
      tmpStr := 'Length : '+IntToStr(Lines.Text.Length)+
      '    Lines : '+IntToStr(Lines.Count)+#13+
      'Ln : '+IntToStr(CurY+1)+
      '    Col : '+IntToStr(CurX+1)+#13+
      'Sel : '+IntToStr(SelLength)+' | ';
      if CurY > 0 then
        tmpStr := tmpStr+IntToStr((SelEndY-SelStartY)+1)
      else
        tmpStr := tmpStr+IntToStr(SelEndY-SelStartY);
    end;
  end;
  MessageDlg(tmpStr, MTInformation, [mbOK], 0);
end;
  1. Once you have done that. Save, Build and Run the Script IDE Demo.

To see issue 1:

  1. Without making any changes to the currently loaded script. Click on the Main Menu Item About.

  2. Now select Test.

  3. A Message Dialog window will open. Showing three lines of information:
    A. Line 1: The number of characters (Length) and Lines in the script file being viewed.
    B. Line 2: The current cursor position within the script file being viewed.
    C. Line 3: The number of character(s) and line(s) currently selected withing the script file being viewed.

    Now in v7.22 and earlier Line 1 will have:
    Length: 163 Lines: 9

    But, with v7.23 and newer Line 1 will always have:
    Length: 0 Lines: 1

    The rest of the information displayed is correct.

  4. Close the Message Dialog and the close the Demo.

To see issue 2:

  1. Either Select the first character in the first line of the script. Or Select the whole first line..
  2. Click on the Main Menu Item About.
  3. Now select Test.
  4. A Message Dialog window will open. Showing three lines if information:
  5. Close the Message Dialog and then close the Demo.
  6. Once you close the Demo you should now be presented with an infinite loop of the following error message:
---------------------------
Scripterproide
---------------------------
List index out of bounds (1)
---------------------------
OK   
---------------------------

I suspect that both of the issues mentioned above. May have been created by the fixes used to fix the issues that I had mentioned earlier this year. And although the first issue is minor in nature. The second issue does seem to be a major one if it is causing that error when closing the application.

Now, there is a possible issue. But I'm not sure if it is a problem with Scripter or with Notepad++. But, I thought that I would bring it up here to get your feed back on this possible issue.

Even if Scripter is working as intended with the above code. There is a difference in what is reported by Scripter and what it reported by Notepadd++.

As I mentioned above Scripter when using the default created project. And having Unit1 being viewed. Scripter will report that there is only 163 characters and 9 lines in the script. But, if I copy and pasted the current script into Notepad++. It will report show that there is 170 characters and 9 lines in the script.

What I can not seem to figure out is if this is a difference in what characters the IDEMemo component is counting as compared to what Notepad++ is counting. Or if this is actually a issue with the IDEMemo component. Can you please shed some light on this for me please?

Use the following code to correctly get the information from the script code:

procedure TForm1.Test1Click(Sender: TObject);
var
  tmpStr: String;
  LocalLines: TStrings;
begin
  with IDEEngine1 do
  begin
    with Memo do
    begin
      if Memo.MemoSource <> nil then
        LocalLines := Memo.MemoSource.Lines
      else
        LocalLines := Memo.Lines;
      tmpStr := 'Length : '+IntToStr(LocalLines.Text.Length)+
      '    Lines : '+IntToStr(LocalLines.Count)+#13+
      'Ln : '+IntToStr(CurY+1)+
      '    Col : '+IntToStr(CurX+1)+#13+
      'Sel : '+IntToStr(SelLength)+' | ';
      if CurY > 0 then
        tmpStr := tmpStr+IntToStr((SelEndY-SelStartY)+1)
      else
        tmpStr := tmpStr+IntToStr(SelEndY-SelStartY);
    end;
  end;
  MessageDlg(tmpStr, MTInformation, [mbOK], 0);
end;

I could not reproduce the 2nd problem.
Regarding the number of characters, that has to do with spaces. If you select all the text in scripter IDE, you will see empty spaces being selected as well. That's what is being counted.
In Notepad++ you also have the same, some lines have spaces and you can see them if you properly set Notepad++ options to display it.

I have sent the original source code for the modified project by email. The attached archive also includes the the exe built with the source code.

With the included exe you will see both of the issues.

Here are three images to help show what I am seeing:

Image1:

Image2:

Image3:

Further testing, I have found that Issue 2 is present in an unmodified build of the ScripterProIDE demo.

I have tried building the ScripterProIDE demo in both Delphi 10.3 Rio Community and in Delphi 10.4 Sydney.

  1. Build and run the unmodified ScripterProIDE demo project.
  2. Select the first line. Do so by pressing Shift+Down Arrow
  3. Leave the first line selected.
  4. Close the ScripterProIDE demo.
    It does not matter if you close the demo by clicking on the Frame's Close button or by clicking on File > Exit.

Now, you should get the infinite Error Message loop.

Thank you very much. We could reproduce and fix the issue. Next release won't have that problem anymore.