Jump to content
pyscripter

SynEdit just got a major uplift

Recommended Posts

Please see these earlier posts on SynEdit history:

 

DirectWrite and Unicode support

One of the major flaws of SynEdit was the poor handling of Unicode.  A major update has been committed to the TurboPack fork, that employs DirectWrite for text painting and fixes Unicode support.  SynEdit should now be on a par with, if not better than, the best editors around with respect to Unicode handling.  For example:

 

Chinese is properly spaced and surrogate pairs and color emojis are fully supported:

 

150265824-cbf6652a-bbbc-457c-9498-5f09f9b60423.png.716821f4d6394eec5b41287a68380210.png

 

Bidirectional text editing is fully supported as well:

 

150266107-fdccabd2-c766-4ec3-a674-13abdf91e63b.png.fca55cb41c3776b50917149cf3ff988d.png

 

WordWrap has been re-written and is now based on DirectWrite as well.  This last update also includes other enhancements as for example an option to alpha blend the selection, another option for selection to cover just selected text instead of full lines, as in VS code and other editors, and horizontal mouse wheel scrolling:

 

152258895-02cc0ccf-dd46-417b-9311-67f5965b52d3.png.fb94e2d33bb73cd762179fb24fec198a.png

 

Other recent improvements:

  • The undo/redo system was buggy and a mess, getting in the way of implementing new features.  I has been reimplemented from scratch.
  • The gutter has been reimplemented from scratch and is now flexible and extensible.
  • A track changes bar like in Visual Studio has been added and unlike Delphi's it saves and restores line state correctly on undo/redo.
  • The code base has been refactored cleaned-up, and partially documented, yet, and despite of the new features, it is thousands of lines shorter than the original.  But a lot more can be done in this area.
  • See here for the full list of enhancements in the the TurboPack fork.

 

image.png.6c0a740e35d3f3a818ba6043ed00c312.png

  

Backward compatibility

Turbopack Synedit remains compatible with earlier versions of Synedit, but you do need to reinstall Synedit, load forms that use SynEdit ignoring error messages and save them again for the new properties to take effect. The use of DirectWrite though means that Windows XP is no longer supported.  The TurboPack SynEdit fork supports Delphi versions Berlin or later.

 

Future plans

The next big planned feature is multi-selection and multi-cursor editing.

 

Support the project

Most of the bugs remaining in the issue tracker are C++Builder related.   Also, the C++ packages have not been updated yet.   We are actively seeking contributions on the C++Builder side of things (package updates, bug fixes).

Of course you can also support the project by submitting bug reports and pull requests.  Or, by implementing new features (e.g. minimap, Sync Edit like in Delphi,  Delphi or VS-code like templates etc.)

 

Note:  Many thanks to @MarkShark for his great contributions to the SynEdit project.

 

 

 

 

 

Edited by pyscripter
  • Like 13
  • Thanks 10

Share this post


Link to post
17 minutes ago, Bob Devine said:

Does the code re-factoring make an FMX port more achievable or is that still out of scope?

I suppose it does a bit.  FMX is using DirectWrite on Windows, and its graphics engine matches the constructs of DirectX (FMX.Canvas.D2D).  One would have to create a VCL abstraction of DirectX that it is similar (possibly identical) to that of FMX.  It could be based on Vcl's Direct2DCanvas.  That would be useful in porting not just SynEdit but other components from Vcl to FMX and the opposite.

Edited by pyscripter
  • Like 3

Share this post


Link to post

Thank you.

Nice to get more features and development

 

I just updated from a source since sept.2021 and here is what I did after upgrading:

New project and a new synedit aligned to client.

Loaded some text (plsql code), about 5000 lines

Run project

And the first thing I do is scroll up and down (page up/down and with mouse dragging vertical scrollbar) ......and the scrolling is lagging/studdering

I turned off IndentGuides and it's a little bit better but still lags.

I created the same project using the earlier version I used before and there is no lag

Noticed also that cpu usage is much higher when scrolling (IndentGuides off) with the new version

 

This is a major turn off for me and for this reason I will revert to the earlier version.

SynEdit has always been so fast and smooth and that has been, for me, one of the it's best feature

I've been using SynEdit, since at least, from 2004 and it's nice it's still being updated but please do not make it slow

 

Is this something anyone else has experienced?

 

 

Edited by dados

Share this post


Link to post
17 hours ago, dados said:

nd the first thing I do is scroll up and down (page up/down and with mouse dragging vertical scrollbar) ......and the scrolling is lagging/studdering

This is not the experience here and in the other testers.  Performance with highlighted 10000s of lines is very good.   Could you please submit an issue at the Issue Tracker with sample project and text file?

Share this post


Link to post
1 hour ago, Stefan Glienke said:

Could be DirectWrite related if you have a rather poor onboard GPU. Check CPU and GPU usage when it's lagging.

This is correct, but this is the reason GPU support is disabled by default:

 

      D2D1RenderTargetProperties(
        {$IFDEF GPUSupport}
        D2D1_RENDER_TARGET_TYPE_DEFAULT,
        {$ELSE}
        D2D1_RENDER_TARGET_TYPE_SOFTWARE, // much faster in my desktop with a slow GPU
        {$ENDIF}


As far as CPU utilization goes, I have tried with a 10K lines pascal file with highlighting, code folding and indentation lines.   Scrolling by pressing continuously the Page Down key results in CPU utiliization around 5% (I7 12700).

With GPUSupport enabled (currently incompatible with Gutter.ShowLineNumbers - will be fixed), CPU utilization remains close to 0% but GPU utilization rises to 5% (Intel UHD 770).

Edited by pyscripter

Share this post


Link to post

I'm using the new SynEdit with the SQL Highlighter.  I've tested with a 250,000 line sql script containing a real mix of statements including comments, string literals, lots of brackets, etc.  I don't see any lag or stuttering.  Make sure to test outside of debug mode as that really seems to affect the dwrite stuff.  My machine isn't a high end machine, it's an AMD mini pc with a mobile 4-core (Ryzen 7 3750H), Windows 11, Delphi 11.  I can't say enough about the new features of the SynEdit, the new gutter stuff, the alpha blended select and especially the new way it does the end of row selections is really nice.  Pyscripter has done an amazing job modernizing the control.  It will be interesting to get feedback on what cpu/gpu people are using and if there are particular settings that seem to affect performance.

  • Like 1

Share this post


Link to post
On 2/10/2022 at 3:30 AM, MarkShark said:

Make sure to test outside of debug mode as that really seems to affect the dwrite stuff.

I'm sorry, insufficient testing on my part.

It seems that running SynEdit in debug mode has a huge affect on performance. Running a release is still fast 🙂

Thank you.

 

Ps. I'm running a Dell Precision laptop with i7-6820HQ + Intel HD 530 + NVIDIA Quatro M1000M

  • Like 1
  • Thanks 1

Share this post


Link to post

More on performance.

 

I loaded a 120 Mb. 3.3million line xml file and that is just blistering.

Then I loaded a 10 Mb. xml file with no line brakes (single line) and it's extremely slow.

Is this something that could be optimized? (large single line file)

 

Compiled and tested in 32 and 64 bit debug and release.

Share this post


Link to post
On 2/15/2022 at 4:59 PM, dados said:

More on performance.

 

I loaded a 120 Mb. 3.3million line xml file and that is just blistering. 

Then I loaded a 10 Mb. xml file with no line brakes (single line) and it's extremely slow.

Is this something that could be optimized? (large single line file)

 

Compiled and tested in 32 and 64 bit debug and release.

formatting such a huge line is huge job.

Share this post


Link to post

Well pyscripter rolled up his sleeves and has made the latest version the fastest one ever.

Loading a 10Mb xml file with a a single line or a 120Mb with 3.3 million lines is now amazingly fast, even with highlighting.

 

Thank you @pyscripter for your great work

  • Like 2
  • Thanks 1

Share this post


Link to post

I have problem with the new version (downloaded yesterday). Application Error: Exception EReadError in module SE_html.exe at 000B5920. Error reading SynEdit.SelectedColor.Alpha: Property Alpha does not exist. I'm using RAD Studio 11 on Windows 10. Any idea what's wrong?

Share this post


Link to post

It sounds like it's a component streaming property error.  Make sure to open each form that has a SynEdit on it in the Delphi IDE and then save the form.  That should fix any of those types of errors.  Another thought is to make sure you have the latest version and to build and install the packages.

Edited by MarkShark

Share this post


Link to post

Unfortunately, it doesn't work. I made a brand new VCL application, just one form, I just dropped TSynEdit on it and tried to compile. The same error occurs. The latest version of SynEdit was installed using GetIt the day before yesterday and is marked 2022.03. I will try to uninstall now and reinstall. By the way, on the same computer I have Delphi version 10.4.2 with an earlier version of SynEdit installed that works properly.

Share this post


Link to post
11 hours ago, dsimun said:

The latest version of SynEdit was installed using GetIt

Getit has not been updated.   To use the latest version use the Github repo instead.

Share this post


Link to post
3 hours ago, pyscripter said:

Getit has not been updated.   To use the latest version use the Github repo instead.

Who is resposible for updating  SynEdit in Getit? Embarcadero?

Share this post


Link to post
4 minutes ago, dummzeuch said:

Who is resposible for updating  SynEdit in Getit? Embarcadero?

Yes. 

Share this post


Link to post
1 hour ago, pyscripter said:
1 hour ago, dummzeuch said:

Who is resposible for updating  SynEdit in Getit? Embarcadero?

Yes. 

😢

Share this post


Link to post
On 2/13/2022 at 8:34 AM, dados said:

It seems that running SynEdit in debug mode has a huge affect on performance. Running a release is still fast 🙂

Thank for pointing this out! I was looking into why so sluggish on my text files (108 MB file size, 1Mio lines), but in release mode is still pretty fast. 🙂 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×