Recent

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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
the else will need a foldblock, but only if needed by config.

Also I am not sure if it should uset the cfbtIfThen, or need a new one.
Both solutions might have side effects.

Pascal

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

i've upgraded TSynPasSyn to use foldblock for "else". I've added cfbtIfElse.
I willl add patch to mantis after further testing.

I also will cleanup TSynEditMarkupFoldColors and have a look at the invalidating part.
It's working most of the time as expected already. Also patch to mantis afterwards.

Regards
Pascal
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

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

is it possible to add the line index of the sfaClose-node to TSynFoldNodeInfo of the sfaOpen-nodes?
This would make invalidation much easier.

Pascal
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
is it possible to add the line index of the sfaClose-node to TSynFoldNodeInfo of the sfaOpen-nodes?
This would make invalidation much easier.

This would mean that when scanning for sfaOpen node, the HL always must search for the close line. Even if calling code does not need this. (if there are 10 open nodes on a line, and only one is needed....)

So it should not be added.

-------------
TLazSynEditNestedFoldsList  should provide this already (and more efficient)

Probably you should get the nodes ONLY via TLazSynEditNestedFoldsList. And then you have all info you need.


Pascal

  • Hero Member
  • *****
  • Posts: 832
This would mean that when scanning for sfaOpen node, the HL always must search for the close line. Even if calling code does not need this. (if there are 10 open nodes on a line, and only one is needed....)

So it should not be added.

But the highlighter keeps a stack of the BlockTypes (TopCodeFoldBlockType). Wouldn't it be easy to just add the nodeinfo of the sfaOpen-node to this stack? On sfaClose you can update the node with the actual lineindex as closing lineindex.

Unfortunately i do not realy understand how these nodeinfos are handled by fold-highlighters. Is there a wiki/doc for this?
I would also like to implement folding for my COBOL-highlighter.

TLazSynEditNestedFoldsList  should provide this already (and more efficient)

Probably you should get the nodes ONLY via TLazSynEditNestedFoldsList. And then you have all info you need.

This would have been my plan B ;)
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter

That is not how the "range" info (and the "stack" that is part of the range) work.

1) They are re-used. one "range" can be pointed to by 100 different lines (even in diff files).

2) Even if the endline could be stored, currently if an empty line (or line without fold relevant info) is inserted, only that line is scanned (well that and the next).
If endline info was stored, any inserted line would need to find all surrounding nodes, and update them.

Pascal

  • Hero Member
  • *****
  • Posts: 832
ah, okay. Then it will be plan B. :D
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
is it possible to add the line index of the sfaClose-node to TSynFoldNodeInfo of the sfaOpen-nodes?
This would make invalidation much easier.

In the meantime I see why that question.

I though TLazSynEditNestedFoldsList had a function to get the endline.

But it is on TSynCustomFoldHighlighter: FoldLineLength on FoldEndLine
They can find the line much faster.

TLazSynEditNestedFoldsList should probably get a method to get the end-line, based on the index of he node:
TLazSynEditNestedFoldsList.NodeEndLine[Index: integer]

Pascal

  • Hero Member
  • *****
  • Posts: 832
Thanks,

works. See latest patch on mantis.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

x2nie

  • Sr. Member
  • ****
  • Posts: 478
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
See latest patch on mantis.


Which one?
When you were logged in, you can see attachments.
Lazarus Trunk @ Windows7 64bit, XP 32bit, Debian under VirtualMachine

Pascal

  • Hero Member
  • *****
  • Posts: 832
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 832
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
FYI: I'll be away the next couple of weeks.

Pascal

  • Hero Member
  • *****
  • Posts: 832
FYI: I'll be away the next couple of weeks.
Holidays or business travel? Anyway, have a good journey!
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 832
x2nie,

did you test the patch?
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)