[Geany-Devel] Plugin Advice
elextr at xxxxx
Fri Jan 24 22:29:45 UTC 2014
On 25 January 2014 07:20, Peter O'Malley <ooomalley at gmail.com> wrote:
> Turns out I'm pretty rusty working in C... I knew it would be something
> silly. Thanks!
> I have another question: the code folding works fine, but I'm having an
> issue with how the fold levels are counted in python. The top block is
> still level 1, but the next block is level 5, I gather because it's
> indented four spaces. I'd prefer if it's counted as level two. I realize
> that due to the rules python has about indenting it makes sense for the
> parser to work this way. However, is there any obvious way I can change it?
> Or would I have to either go deep into Scintilla to "fix" something that
> isn't broken, or try to work around it at the top level? I'm basically
> wondering if I'm missing anything obvious.
Deep in LexPython.cxx :)
1) The level number the folder produces is for folding purposes, not Python
syntax, so for eg successive lines of triple quoted strings have the level
increased by one to cause the string to be foldable, even though the actual
source is not indented further.
2) The folder only works for PEP8 styled files, some legal but non-PEP-8
implicit or explicit line continuation situations are folded wrongly
3) An increase in the level number is the fold point, not what the number's
value is. Or you could read the SC_FOLDLEVELHEADERFLAG flag which erm ...
flags the start of a fold.
4) The folder would have to always count increases/decreases from the start
of the file to actually get a level that counts correctly or save state on
the file. At the moment it starts from near the start of the visible range
most of the time to make it faster, and saves no state so it only knows the
actual indentation, not the level number. You will have to keep count
yourself as you go through the file clearing/setting the fold points.
> On Fri, Jan 24, 2014 at 9:12 AM, Colomban Wendling <
> lists.ban at herbesfolles.org> wrote:
>> Le 24/01/2014 17:56, Peter O'Malley a écrit :
>> > [...]
>> > I will hopefully soon have something completed to work with, but at
>> > the moment I'm having trouble getting my plugin to compile as part of
>> > geany-plugins; for some reason GETTEXT_PACKAGE is undeclared even
>> > though LOCALEDIR is fine. Once I have enough time to sort that out
>> > I'll create a pull request so y'all can take a look and see if you're
>> > interested in it.
>> Do you include config.h?
>> Devel mailing list
>> Devel at lists.geany.org
> Devel mailing list
> Devel at lists.geany.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel