[Geany-devel] Indentation using regex (was [PATCH 14/19] Rewrite tab switching queue)

Lex Trotman elextr at xxxxx
Wed Sep 22 11:47:20 UTC 2010


On 22 September 2010 20:47, Jiří Techet <techet at gmail.com> wrote:
> Hi Lex,
>
> On Tue, Sep 21, 2010 at 02:41, Lex Trotman <elextr at gmail.com> wrote:
>> Hi Jiri,
>>
>> Got it working, I'd put the regexes in the filetypes in the wrong
>> prefix, my mistake :-D
>>
>> But it doesn't seem to be working as expected.
>>
>> Using only the first two of your regexes the following gets:
>>
>> class foo {
>>    struct bar {
>>        int i;
>>    };
>>    }
>
> This works for me - if you press }, it should get unindented. How did
> you enter the code (copy-paste or something like that)?

No, I just typed it in order from the first character to the last }.
Note that the } before did undent correctly.  Any suggestions what to
look at?

>
>>
>> fair enough, the } regex doesn't expect anything after it so I added
>> .* after the } but now I get
>>
>> class foo {
>>    struct bar {
>>        int i;
>> };
>> }
>>
>> The }; line undents two levels??
>
> Your regex is not correct - the (un)indent_this_line_regex is
> evaluated every time you press a key and if it is satisfied, the
> current line gets (un)indented. So with ^[[:blank:]]*\\}.*$ you used,
> the regex first matches
>
> }
>
> and after you type ";", it again matches
>
> };
>
> so it unindents twice. This means the last character in the regex
> should be the one that causes the change of indentation "}" in this
> case.

Ok, so the previous has to be made to work.

Cheers
Lex
>
> Cheers,
>
> Jiri
>
>>
>> Cheers
>> Lex
>>
>>
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list