On Tue, 16 Dec 2008 04:58:48 +0100 (CET), ioguix@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@btinternet.com wrote:
On Tue, 9 Dec 2008 05:14:08 +0100 (CET) ioguix@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