Revision: 4493 http://geany.svn.sourceforge.net/geany/?rev=4493&view=rev Author: frlan Date: 2009-12-20 12:03:28 +0000 (Sun, 20 Dec 2009)
Log Message: ----------- Extend auto_latex() function to check whether an environment has been closed within the next lines to avoid auto adding double \end{}.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-12-12 16:21:17 UTC (rev 4492) +++ trunk/ChangeLog 2009-12-20 12:03:28 UTC (rev 4493) @@ -1,3 +1,10 @@ +2009-12-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> + + * src/editor.c: + Extend auto_latex() function to check whether an environment has been + closed within the next lines to avoid auto adding double \end{}. + + 2009-12-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* geany.glade, src/interface.c:
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2009-12-12 16:21:17 UTC (rev 4492) +++ trunk/src/editor.c 2009-12-20 12:03:28 UTC (rev 4493) @@ -2043,6 +2043,28 @@ } }
+ /* Search whether the environment is closed within the next + * lines. We assume, no \end is needed in such cases */ + /* TODO using sci_find_text() should be way faster than getting + * the line buffer and performing string comparisons */ + for (i = 1; i < 5; i++) + { + gchar *tmp; + gchar *end_construct; + tmp = sci_get_line(sci, line + i); + /* Again get to the first non-blank char */ + start = 0; + while (isspace(buf[start])) + start++; + end_construct = g_strdup_printf("\end%s{%s}", full_cmd, env); + if (strstr(tmp, end_construct) != NULL) + { + utils_free_pointers(3, tmp, buf, end_construct, NULL); + return; + } + g_free(tmp); + } + /* get the indentation */ if (editor->auto_indent) read_indent(editor, pos);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.