Auto Indentation for Python

Here’s my preliminary idea for the auto indentation for Python in Anjuta.

/* When a new line character is inserted (user pressed Return after a line),
* the following pseudo code could be executed. Here currentline is
* the line number of the present line (after which the new line is
* supposed to begin.
* Assumption: Ignoring multilines for now.
*/
if (there is a colon at the end of currentline)
{
        line_indent = get_indentation (currentline) + INDENT_SIZE;
}
else
{
        line = currentline;
        while (line is a blank or spaces-only line)
                line–;
        line_indent = get_indentation (line);
}
return line_indent;

I am thinking of coding this approach, testing and improving. I know this is too naive, but I just want to start with something. The multilines and other special cases that follow thereafter would provide for further tweaking. This whole project seems like a nice TopCoder Marathon Match, where the first submission is always a naive solution, and things improve over successive submissions. Would be nice to follow the “commit early, commit often” theory during this GSoC