Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Incorrect SetFoldLevel signature #70

Closed
@Ekopalypse

Description

@Ekopalypse

SetFoldLevel needs to have an integer type as its second parameter instead of the FoldLevel enum.

Activity

mahee96

mahee96 commented on May 23, 2021

@mahee96
Collaborator

@Ekopalypse , There are auto generated enums in GatewayDomain.cs file, this was intentional to have more meaning to the flag grouping.

public enum FoldFlag
        {
            LINEBEFORE_EXPANDED = 0x0002,
            LINEBEFORE_CONTRACTED = 0x0004,
            LINEAFTER_EXPANDED = 0x0008,
            LINEAFTER_CONTRACTED = 0x0010,
            LEVELNUMBERS = 0x0040,
            LINESTATE = 0x0080
        }

Why don't you try using it instead, if you still face issue re-open this issue.

If you strongly feel it should be int/uint as per the official interface doc of Scintilla, then please open a new issue as question because it covers more fields than the FOLDFLAG alone and needs to be dealt separately.

Ekopalypse

Ekopalypse commented on May 23, 2021

@Ekopalypse
Author

@mahee96
But FoldFlag enum is something else and is used by the call SCI_SETFOLDFLAGS.
SCI_SETFOLDLEVEL sets the current level per line and is used to determine which rows must be must be collapsed/expanded, while FoldFlags describe how folded/expanded rows should be visually displayed.

mahee96

mahee96 commented on May 23, 2021

@mahee96
Collaborator

Oops sorry for the confusion, I meant to refer you to FoldLevel enum in the Gatewaydomain.cs, Could you please check that enum satisfies your request

mahee96

mahee96 commented on May 23, 2021

@mahee96
Collaborator

@Ekopalypse checkout this

/// <summary>The number of display lines needed to wrap a document line (Scintilla feature SC_FOLDLEVEL)</summary> 
public enum FoldLevel { 
     BASE = 0x400, 
     WHITEFLAG = 0x1000, 
     HEADERFLAG = 0x2000, 
     NUMBERMASK = 0x0FFF 
}
Ekopalypse

Ekopalypse commented on May 23, 2021

@Ekopalypse
Author

No, these are the flags which need to be used in combination with additional integers.
Let me give you an example, assume in the following code and we want to mark the { as the open folding tag and } as the closing tag like npp does.

        public enum FoldLevel
        {
            BASE = 0x400,
            WHITEFLAG = 0x1000,
            HEADERFLAG = 0x2000,
            NUMBERMASK = 0x0FFF
        }
        

To set the respective flags you would set to line
0 -> BASE
1 -> BASE | HEADERFLAG
2 - 6 -> BASE + 1
7 -> BASE

Now scintilla knows where to put the folding markers and how many lines to collapse or fold.

Ekopalypse

Ekopalypse commented on May 23, 2021

@Ekopalypse
Author

Maybe this example is more descriptive

public
{
	{
		{
			value
		}
	}
}

The lines need to be set like
0x0400
0x2400
0x2401
0x2402
0x0403
0x0403
0x0402
0x0401
0x0400

pinned this issue on May 24, 2021
self-assigned this
on May 24, 2021
added
py-converter-update-requiredPython converter files under /ToolsForMaintainersOfTheProjectTemplate requires modification
on May 24, 2021
mahee96

mahee96 commented on May 24, 2021

@mahee96
Collaborator

okay there is a slight discrepancy in Scintilla.iface file and the official documentation which we have to fix.

The documentation states:

SCI_SETFOLDLEVEL(line line, int level)
SCI_GETFOLDLEVEL(line line) → int

whereas the Scintilla.iface file states:

# Set the fold level of a line.
# This encodes an integer level along with flags indicating whether the
# line is a header and whether it is effectively white space.
set void SetFoldLevel=2222(line line, FoldLevel level)

# Retrieve the fold level of a line.
get FoldLevel GetFoldLevel=2223(line line,)

I think while updating the converter, we missed some info which states the obvious for types and enumerations.

So essentially those enumerations if in C/C++ would be not typed but plain integers which could be combined using plain pipe/or operation. But in C# it needs to be of int type as the document states.

mahee96

mahee96 commented on May 24, 2021

@mahee96
Collaborator

@Ekopalypse , a quick fix can be made for this particular field for now, but the inventory of affected fields will be performed later some time and a fix will be given.

17 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpy-converter-update-requiredPython converter files under /ToolsForMaintainersOfTheProjectTemplate requires modification

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @kbilsted@guidomarcel@Ekopalypse@mahee96

    Issue actions

      Incorrect SetFoldLevel signature · Issue #70 · kbilsted/NotepadPlusPlusPluginPack.Net