[Geany] UNindent close of statement

Lex Trotman elextr at xxxxx
Thu Aug 5 23:37:00 UTC 2010


On 6 August 2010 09:01, Jiří Techet <techet at gmail.com> wrote:
> On Fri, Aug 6, 2010 at 00:20, Lex Trotman <elextr at gmail.com> wrote:
>> 2010/8/6 Enrico Tröger <enrico.troeger at uvena.de>:
>>> On Sun, 01 Aug 2010 17:19:54 -0700, Doug wrote:
>>>
>>>>
>>>>> Unfortunately Scintila which is the editing component used by Geany
>>>>> does not allow any distinction between types of operators.  To add
>>>>> this you would have to edit the C++ code in Scintilla that parses the
>>>>> file for highlighting.
>>>>>
>>>>What I'd like to be able to do is have Geany UNindent a line that
>>>>closes a statement in Lua .. i.e.
>>>>
>>>>if x > 1 then
>>>>   y = 5
>>>>else
>>>>   y = 2
>>>>end  -- automatically Unindent the 'end'
>>>>
>>>>I know this can be done in Scintilla and SciTE has a set of properties
>>>>that does this as well as some other editors that use scintilla but see
>>>>no way to specify using certain keywords as such a do and end only the
>>>>more standard operators like {} and (). Can this be done in Geany?
>>>
>>> As usual, this just needs to be implemented. It's quite independent
>>> from Scintilla itself, this is pure application logic. I think this
>>> could be done in a plugin, maybe as component of the addons plugin.
>>
>>
>> Hey Enrico,
>>
>> I guess that Geany can always ignore the fold info coming from the
>> Scintilla lexer, but what would you propose as the algorithm.  When to
>> follow Scintilla and when to ignore it?
>
> From what I see in the sources, scintilla only says how much to indent
> but it's geany itself who decides whether to indent or not.
>
> Cheers,
>
> Jiri

Disregard previous comment, I was confusing it with something else and
the answer is kinda scrambled :-D.

I agree that indenting currently doesn't work well.  For {} languages
if there is anything on the line after the { then indenting fails to
work right.  And as you say Python really gets no help either.

There is a hard coded special case for Perl that seems to cause some
of these problems. Also currently I think { in comments can affect
indenting.

Your idea of per language regexes sounds good, and I'd suggest using
the Scintilla style to avoid checking within comments and strings.

Cheers
Lex

>
>>
>> Cheers
>> Lex
>>
>>>
>>> Regards,
>>> Enrico
>>>
>>> --
>>> Get my GPG key from http://www.uvena.de/pub.asc
>>>
>>> _______________________________________________
>>> Geany mailing list
>>> Geany at uvena.de
>>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>>>
>>>
>> _______________________________________________
>> Geany mailing list
>> Geany at uvena.de
>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>>
> _______________________________________________
> Geany mailing list
> Geany at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>



More information about the Users mailing list