Recent

Author Topic: Invite to Colorizing TSynEdit ! {Improving Editor for Editing Complex Codes}  (Read 158020 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
There may be several ways to make the Markup designer ready.

Further more: (Mainly issues with 2 or 3)

Current SynEdit has many markup pre-installed. Ideally (if they are unmodified) they should not be streamed.

Alternatively, a 2nd SynEdit without any markup pre-installed could be created and published. But then it is not only markup, there are "views" (folded view), and maybe other things. And its all or none.

Also, when markups are editable via OI, then some of them are already editable via properties on SynEdit, and that must not cause conflicts.

And lastly if you can add/remove them, markups must be ignored if they are added by other modules (sync edit does add markups)

llutti

  • New Member
  • *
  • Posts: 23
Hi,

  I download the SVN version of synedit and I tried to use the new TSynEditMarkupFoldColor, but when I run my application occurs an error in line 1551 of the file SynEditHighlighter.pp in function StartAtLineIndex when using the procedure SetLine.

  My question is, can I using this new markup to test?

Regards,

Luciano

Pascal

  • Hero Member
  • *****
  • Posts: 932
Martin, x2nie,

i've build a patch to make it work again in the ide and
did an update for the position of the vertical line.

Please review and commit it to trunk.

Regards
Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Please put on mantis, so it will not be forgotten.

What is FColumnOfFirstCharacterInRow? It is never set. (Other than initial -1)

Also this isn't exactly something that belongs in the HL. The hl should not be burdened with added work.

Please keep different fixes and/or optimizations separate.

Pascal

  • Hero Member
  • *****
  • Posts: 932
It's to get the first non space charachter for the line.
In this column the vertical line will be.
It's set in the Next procedure of the highlighter (only implemented in pas right now).
So the Markup does not have to scan every line again and again.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
I assumed that much.

But the pas hl does not appear to be in the patch?

Also it should be once per line, never mind where. And the HL is used without markup too, so any burden that can be avoided, should be avoided.

Pascal

  • Hero Member
  • *****
  • Posts: 932
You are right. It's missing.
I've attached an updated patch.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Again:

1) bugtracker, otherwise it gets forgotten. (sorry it may be a while until I have time to look at it)

2) separate actual fixes, from enhancements.
As it currently stands FColumnOfFirstCharacterInRow is not going to make it.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Okay.

I will redesign it and submit a patch to mantis.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Martin,

2 questions:

How to handle the kept color if "for/do", "with/do" and "if" start in different rows (green lines)? I think in this case the color should not be kept.

What about the vertical line at the "and"s? Should it be there or should it be omitted?

Regards
Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Martin,

the "else" part should also have a verticalline like the "if" part, shouldn't it?
How can i get the information about the "else" part? There is not TPascalCodeFoldBlockType for "else".
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
The code is currently as contributed by x2nie.

I havent looked at it yet in detail, so I dont know the answers.

I have been very busy so far for this year, and I dont know when there will be more work on this.

Pascal

  • Hero Member
  • *****
  • Posts: 932
And what is your opinion to the post before?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
There will be user config which keywords get a line, and which do not. I already have some code for that, but it is not committed.
There are actual painting bugs in the code at the moment (search this thread for "invalidation"), so until they are fixed, I am not adding anything else.

Also if you plan to make changes to the code, keep in mind, that the invalidation issue may mean, that substantial parts may need to be written from scratch. So changes may get lost....

I have not spent much thought on, if for/do/with should be one or 2 colors (personally, 2 colors, or only ONE line at all), but maybe configurable.

As for the "and" that is the "if" line. Lines (like folding) start at the keyword, maybe the better choice of keyword would be the "then"
But that is fine tuning. (maybe even already configurable)

Yes to the "else".


Pascal

  • Hero Member
  • *****
  • Posts: 932
Martin,

i've managed to only "sfaOutlineKeepColor" if child is on the same line.
As cfbtProcedure also has sfaOutlineKeepColor set, which always has to keep color
i introduced a "sfaOutlineKeepColorOnSameLine" for if/then, fo/do, while/do and with/do.

Code: Pascal  [Select][+][-]
  1.     if (PasBlockType in [cfbtIfThen,cfbtForDo,cfbtWhileDo,cfbtWithDo]) then
  2.       Include( aActions, sfaOutlineKeepLevelOnSameLine);
  3.  
  4.     if (PasBlockType in [cfbtProcedure]) then
  5.       aActions := aActions + [sfaOutlineKeepLevel,sfaOutlineNoColor];

For the else part of the if-statement:
Is ist posible to implement sfaOpen/sfaClose in the Pascal highlighter?
Otherwise i can not have a vertical line for the else part.

Regards
Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018