2010/8/5 Enrico Tröger enrico.troeger@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.
By coincidence, I have been playing with TextMate under MacOS and it has an extremely elegant system of indent detection, see:
http://manual.macromates.com/en/appendix#indentation_rules
This is extremely flexible because the indent and unindent conditions can be set based on per-language regular expressions (and not like now hardcoded for languages with braces and python). I think that geany's way of indent detection could be completely substituted by this - in fact, I think that this would actually reduce the amount of code needed because you would just do matches against the regular expressions instead of checking the lines character by character. The patterns could be set for every language e.g. in filetype_extensions.conf.
Some observations from playing with TextMate: 1. increaseNextLinePattern is not normally used, see
http://ticket.macromates.com/show?ticket_id=425D3D1C
so we could drop it.
2. decreaseIndentPattern appears to be matched against the current line after every single keypress (e.g. once you type ':' in "elsif:" in python, the line containing it unindents). Apparently regex matching is fast enough to do this. The other patterns are matched only when enter is pressed.
From playing with the editor this system seems to work really well. I
think we could even steal the patterns from it - I wonder how much illegal/unethical it is to copy configuration options from a commercial editor...
What is your opinion about this?
(By the way, TextMate is a really nice editor with similar scope as Geany and there are definitely lessons Geany could learn from it [but vice versa too])
Regards,
Jiri
Regards, Enrico
-- Get my GPG key from http://www.uvena.de/pub.asc
Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany