Revision: 4591 http://geany.svn.sourceforge.net/geany/?rev=4591&view=rev Author: frlan Date: 2010-01-29 19:16:08 +0000 (Fri, 29 Jan 2010)
Log Message: ----------- Backport from trunk: Extend auto_latex() function to check whether an environment has been closed within the next lines to avoid auto adding double \end{}.
Modified Paths: -------------- branches/geany-0.18.1/ChangeLog branches/geany-0.18.1/src/editor.c
Modified: branches/geany-0.18.1/ChangeLog =================================================================== --- branches/geany-0.18.1/ChangeLog 2010-01-29 19:15:12 UTC (rev 4590) +++ branches/geany-0.18.1/ChangeLog 2010-01-29 19:16:08 UTC (rev 4591) @@ -1,9 +1,15 @@ 2010-01-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> - * doc/plugins.dox: Add gcc commands to build a plugin to the HowTo.
+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-11-30 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* data/latex.tags:
Modified: branches/geany-0.18.1/src/editor.c =================================================================== --- branches/geany-0.18.1/src/editor.c 2010-01-29 19:15:12 UTC (rev 4590) +++ branches/geany-0.18.1/src/editor.c 2010-01-29 19:16:08 UTC (rev 4591) @@ -1986,6 +1986,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.