Giter Site home page Giter Site logo

Comments (8)

theryan722 avatar theryan722 commented on September 13, 2024

I really wish we could set labels so not everything is posted as an issue.

from scintillanet.

Ahmad45123 avatar Ahmad45123 commented on September 13, 2024

IDK if its implemented in ScintillaNET or not but in native scintilla, I think you will use this: SCI_GETFOLDEXPANDED

from scintillanet.

jacobslusser avatar jacobslusser commented on September 13, 2024

The SCI_GETFOLDEXPANDED constants translates to the Line.Expanded property in ScintillaNET. That will tell you whether the line is marked as expanded or collapsed, however, to determine if a line is a fold point you should test for the FoldLevelFlags.Header flag. i.e.

if((scintilla.Lines[0].FoldLevelFlags & FoldLevelFlags.Header) > 0)
{
    // ...
}

from scintillanet.

theryan722 avatar theryan722 commented on September 13, 2024

Sorry, but the code isn't working for me.

from scintillanet.

jacobslusser avatar jacobslusser commented on September 13, 2024

Can you be more specific? It's difficult for me to provide assistance with such little information to go on....

When I run the following code, the output matches 1 for 1 with my fold points:

foreach (var line in scintilla.Lines)
{
    var message = "Lines[{0}] - fold level: {1}, is fold point: {2}";
    Debug.WriteLine(message, line.Index, line.FoldLevel, ((line.FoldLevelFlags & FoldLevelFlags.Header) > 0));
}

from scintillanet.

theryan722 avatar theryan722 commented on September 13, 2024

Okay sorry about that. You example fixed my issue, however I am having trouble folding/expanding a line.

Here is what I have:

public object LineIsFoldPoint(bool linenum)
{
    return ((Scintilla1.Lines(linenum).FoldLevelFlags & FoldLevelFlags.Header) > 0);
}

public void FoldAll()
{
    foreach (Line ln in Scintilla1.Lines) {
        if (LineIsFoldPoint(ln.Index)) {
            ln.FoldLine(FoldAction.Contract);
        }
    }
}

The FoldAll() method does nothing for me, the same if I try FoldAction.Toggle or FoldAction.Expand

from scintillanet.

jacobslusser avatar jacobslusser commented on September 13, 2024

Scintilla.FoldAll(FoldAction.Toggle) does exactly as advertised for me....

Are you implementing custom folding or using one provided by a lexer? If you are implementing your own, the chances are your error is in your implementation. Custom folding can be difficult. Studying the Scintilla lexer source code can be helpful here as can be helper methods which dump your current FoldLevel and FoldLevelFlags as the sample I have above does.

from scintillanet.

theryan722 avatar theryan722 commented on September 13, 2024

WHAT, how did I not see this?! Thank you!

from scintillanet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.