Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

Syntax Highlighting Editors In Delphi & C++Builder On Windows

A popular syntax highlighting editor for Delphi is called TSynEdit. This post is mainly focused on the various forks of TSynEdit and which one you might want to use in your own projects. The Dev C++ project uses TSynEdit which needed to be upgraded when it was lifted from compiling in Delphi 6 to compiling in Delphi 10.4. The three options are:

Currently, the new Embarcadero Dev C++ v5.50 version uses the TurboPack TSynEdit fork which is also the same version that is available via Embarcadero’s GetIt. The TSynEdit edition (#3 above) seems to receive the most frequent updates while the TSynEdit-2 fork has some interesting features (see below).

Developer Kiriakos Vlahos (aka PyScripter) recounts the history of TSynEdit and some information about the three versions in a post on DelphiPraxis:

“I will start with a bit of history.

  • The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, a great programmer.  The key feature of the editor was fast syntax highlighting.  This was more than 20 years ago.
  • After a split of the community the SynEdit project was formed maintaining some of the key features of mwEdit.
  • Over the years some of the best Delphi programmers contributed to the project.  The list includes for example Gerald Nunn, Eric Grange, Jordan Russell and many many others.
  • Flavio Etrusco added word wrap and Maël Hörz added unicode support (but in a rather idiosyncratic way).
  • However the project management was very weak and the code gradually became very hard to maintain and improve.  It aimed to support very old Delphi versions including Kylix and the code became full of IFDEFs and patches without an overall coherence.
  • An early fork of Synedit is part of Lazarus but the two development efforts have diverged a great deal.
  • When Embarcadero introduced the GetIt package manager they asked Roman Kassebaum to produce a version of SynEdit for GetIt.  Roman did a general code cleanup removing support for early Delphi versions and Kylix (Turbo fork(s)).
  • I have added support for code folding (the first major new feature for years) to both the Turbo fork and the main Synedit repository.
  • However the Turbo fork(s) were not actively supported or developed beyond recompiling for new Delphi versions and the main Synedit branch was too hard to work with, hence the creation of SynEdit-2 as a fork of Turbo SynEdit.

Main new features in SynEdit-2:

  • Replaced SynRegExpr with the built-in RegularExpressions
  • Move/Copy Line(s) Up/Down commands as in VS Code
  • Delete Line command should work with multi-line selection
  • Handle triple and quadruple clicks for selection
  • Triple click and drag should select lines 
  • Double click and drag should select whole words 
  • Support OLE Drag & Drop 

What are the key features missing in Synedit:

  • Better Unicode handling:
    • Better support for wide characters e.g. Chinese ideograms (爾雅爾雅爾雅爾雅)
    • Support for surrogate pairs (two widechars correspond to one glyph)
    • Combining characters (e.g. Åström ḱṷṓn)
  • Multi-cursor and multi-selection editing as in VS Code.

When these features get implemented I think SynEdit will become comparable to some of the best editors around. But both of them require major rewriting of the code.  Work on the second is well advanced and the unicode work is in the planning stage.” – PyScripter

Head over and check out the full discussion about TSynEdit over on DelphiPraxis.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.