Recent

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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 932
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 x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
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 x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 932
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 x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 932
ah, okay. Then it will be plan B. :D
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 932
Thanks,

works. See latest patch on mantis.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • 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 Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Pascal

  • Hero Member
  • *****
  • Posts: 932
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
FYI: I'll be away the next couple of weeks.

Pascal

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

Pascal

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

did you test the patch?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018