jacobslusser / ScintillaNET

A Windows Forms control, wrapper, and bindings for the Scintilla text editor.
MIT License
964 stars 242 forks source link

Fold Lines after the first line #514

Closed davidbuckleyni closed 3 years ago

davidbuckleyni commented 3 years ago

I have an xml document am trying to use the FoldAction .Contract but its also folding the subitems into one line closing the root node i want the root node to stay open which is at line one of my document but the items within to be collapsed is their a way to say not collapse the root?

davidbuckleyni commented 3 years ago

In fact it doesnt even coaplse the child items after some testing the folder nodes are open when i click the root node to expand again. I want the child items to remain closed.

davidbuckleyni commented 3 years ago

I see the code here also for markers but this doesnt appear to work when you have folds as well.

https://github.com/jacobslusser/ScintillaNET/wiki/Markers-and-Bookmarking-Lines

VPKSoft commented 3 years ago

So you are trying to achieve this (?): image

davidbuckleyni commented 3 years ago

Yes also I have an issue with duplication book marks showing yes that correct but i still need to collapse the root node then when it expands the sub items should be still closed exaclty how notepad ++ which is open source and using the same works am programming in c# btw @VPKSoft

davidbuckleyni commented 3 years ago

Like this image

@VPKSoft

davidbuckleyni commented 3 years ago

I also would like my folder plus minus to show more like this

image By that i mean only on the root nodes if that is is possble

VPKSoft commented 3 years ago

The screen captures I took are from a library for creating lexers for ScintillaNET, see ScintillaLexers. The folding for XML is implemented for XML in the library with many others in C#. I don't know about the vertical line though.

davidbuckleyni commented 3 years ago

Can u still keep the root node with a plus beside it in ur example theirs not @VPKSoft i wonder how notepad plus plus does it as it using same editor.

davidbuckleyni commented 3 years ago

I got it sorted only thing is appears to be a gap between my bookmarks and my folding also my book mark is tiny small not same size as notepad++ any ideas, its almost 3 pixels in size real tichy i have line number,book mark, what appears to be a blank space then the folding.

davidbuckleyni commented 3 years ago

The screen captures I took are from a library for creating lexers for ScintillaNET, see ScintillaLexers. The folding for XML is implemented for XML in the library with many others in C#. I don't know about the vertical line though.

i STILL HAVE not got this fixed but ur docs is very confusing i only want the folding out of your program can you help for xml

davidbuckleyni commented 3 years ago

For anyone else doing this in another project you have to do something like this.

foreach (var scintillaLine in editorControl1.Lines)
 {
                scintillaLine.FoldLine(FoldAction.Contract);
  }

And to Unfold

foreach (var scintillaLine in editorControl1.Lines)
 {
                scintillaLine.FoldLine(FoldAction.Expand;
  }