[Geany-devel] Patch adding auto-close brackets, braces and string r1
Nick Treleaven
nick.treleaven at xxxxx
Mon Dec 15 13:12:54 UTC 2008
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.
BTW, you could use sci_find_matching_brace() instead of SSM().
> In a second step, I think we could try to detect if we are already in
> a string before auto-closing quotes. Moreover, if we are indeed in a
> string we could auto-secape any quotes putted in. However, I think
> this should be configurable.
>
> About these second step, I hadn't too much time to investigate the
> code, but:
> - is it possible to actually know what is the current applied style ?
Yes, sci_get_style_at().
> - 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.
> - about the auto-escaping quotes, it would need some mechanism to
> exactly know how the current language style is actually escaping them
> (obviously C or SQL doesn't escape string in the same way)
Not sure about this, could be awkward to maintain. But I suppose full
filetypes support is not necessary.
Personally I think good bracket completion could be fairly involved,
maybe it would be better as a plugin, not sure.
Regards,
Nick
More information about the Devel
mailing list