Revision: 1150 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1150&view=re... Author: frlan Date: 2010-01-31 20:59:51 +0000 (Sun, 31 Jan 2010)
Log Message: ----------- GeanyLaTeX: Insert an additional {} in case of we have a block environment
Modified Paths: -------------- trunk/geanylatex/src/latexenvironments.c
Modified: trunk/geanylatex/src/latexenvironments.c =================================================================== --- trunk/geanylatex/src/latexenvironments.c 2010-01-31 20:58:42 UTC (rev 1149) +++ trunk/geanylatex/src/latexenvironments.c 2010-01-31 20:59:51 UTC (rev 1150) @@ -71,12 +71,18 @@ { gchar *selection = NULL; gchar *replacement = NULL; - const gchar *eol = editor_get_eol_char(doc->editor); selection = sci_get_selection_contents(doc->editor->sci);
- replacement = g_strconcat("\begin{", environment, "}", - eol,selection, eol, "\end{", environment, "}", eol, NULL); - + if (utils_str_equal(environment, "block") == TRUE) + { + replacement = g_strconcat("\begin{", environment, "}{}\n", + selection, "\n\end{", environment, "}\n", NULL); + } + else + { + replacement = g_strconcat("\begin{", environment, "}\n", + selection, "\n\end{", environment, "}\n", NULL); + } sci_replace_sel(doc->editor->sci, replacement); g_free(selection); g_free(replacement); @@ -88,23 +94,28 @@ gint len = strlen(environment); GString *tmpstring = NULL; gchar *tmp = NULL; - const gchar *eol = editor_get_eol_char(doc->editor);
tmpstring = g_string_new("\begin{"); g_string_append(tmpstring, environment); - g_string_append(tmpstring, "}"); - g_string_append(tmpstring, eol);
+ if (utils_str_equal(environment, "block") == TRUE) + { + g_string_append(tmpstring, "}{}"); + } + else + { + g_string_append(tmpstring, "}"); + } + g_string_append(tmpstring, "\n"); + if (type == GLATEX_ENVIRONMENT_TYPE_LIST) { - g_string_append(tmpstring, "\t\item"); - g_string_append(tmpstring, eol); + g_string_append(tmpstring, "\t\item\n"); }
g_string_append(tmpstring, "\end{"); g_string_append(tmpstring, environment); - g_string_append(tmpstring,"}"); - g_string_append(tmpstring, eol); + g_string_append(tmpstring,"}\n");
tmp = g_string_free(tmpstring, FALSE); glatex_insert_string(tmp, FALSE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.