[Geany-devel] Patch adding auto-close brackets, braces and string r1

Enrico Tröger enrico.troeger at xxxxx
Thu Dec 18 16:03:54 UTC 2008


On Tue, 16 Dec 2008 04:58:48 +0100 (CET), ioguix at free.fr wrote:

>
>
>On Mon, 15 Dec 2008, Enrico Tröger wrote:
>
>> On Mon, 15 Dec 2008 13:12:54 +0000, Nick Treleaven
>> <nick.treleaven at btinternet.com> wrote:
>>
>>> On Tue, 9 Dec 2008 05:14:08 +0100 (CET)
>>> ioguix at free.fr wrote:
>>>
>>>> In a first step, when opening a brace (ie. ( { [ ), we could check
>>>> if no closing brace already match it before auto-closing it. That
>>>> what I tried to do in the attached patch.
>>
>> I actually worked on the patch yesterday but had some weird
>> connectivity issues (some sites weren't reachable including
>> sourceforge.net, so no commits).
>Ok. Let me know if this patch need some more work and you prefer me to 
>work on this a little bit more.
>However, it could be easier to commit small bunch of patch instead a
>big one. Easier to review as well. But it's a matter of taste :) .

Sure, I already committed your patch on Monday.


>>>> - can we really test if we are actually in a in string whatever the
>>>> current language style ?
>>>
>>> Yes, but maybe not all filetypes are completely supported. See
>>> is_string_style() in editor.c.
>>
>> Though this function treats all kinds of strings equally, that is for
>> languages like C or Python where you have different kind of strings
>> ('blah', "blah", ''' blag ''', ...) this function returns TRUE for
>> all kinds. But you probably want something more fine-grained to
>> differentiate between 'blah' and "blah".
>Ok. This is a good start anyway. We could at least disabling
>auto-close quotes inside a string...
>However, I noticed simple quoted strings and double quoted strings are 
>sometime highlighted with different colors (depending of the current 
>language type, C doesn't, PHP does)...So I guess Scintilla parser has
>some internal mechanism to handle this.

More exactly: the lexers for different languages handle strings
differently, mostly according to the language specs.
E.g. in C, "blah" is something different than 'blah' though they are
coloured the same in Geany. But these are two different styles, you
could change the colours in your local config and so you can also
differentiate them in the code (SCE_C_STRING vs. SCE_C_CHARACTER).
Similar for other languages/lexers but some handle different kinds of
string equally, IIRC. But in those cases there is also no need to
differentiate them for brace completion.



Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20081218/9b5b5f98/attachment.pgp>


More information about the Devel mailing list