Revision: 1336 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1336&view=re... Author: frlan Date: 2010-05-05 21:11:20 +0000 (Wed, 05 May 2010)
Log Message: ----------- GeanyLaTeX: Respect indention on inserting environment
Modified Paths: -------------- trunk/geanylatex/src/latexenvironments.c
Modified: trunk/geanylatex/src/latexenvironments.c =================================================================== --- trunk/geanylatex/src/latexenvironments.c 2010-05-05 21:10:29 UTC (rev 1335) +++ trunk/geanylatex/src/latexenvironments.c 2010-05-05 21:11:20 UTC (rev 1336) @@ -92,11 +92,13 @@ } else { - gint pos = sci_get_current_position(doc->editor->sci); - gint len = strlen(environment); + gint indent, pos, len; GString *tmpstring = NULL; gchar *tmp = NULL;
+ pos = sci_get_current_position(doc->editor->sci); + len = strlen(environment); + sci_start_undo_action(doc->editor->sci);
tmpstring = g_string_new("\begin{"); @@ -122,8 +124,15 @@ glatex_insert_string(tmp, TRUE); g_free(tmp);
+ indent = sci_get_line_indentation(doc->editor->sci, + sci_get_line_from_position(doc->editor->sci, pos)); + tmp = g_strdup_printf("\n\end{%s}\n", environment); glatex_insert_string(tmp, FALSE); + + sci_set_line_indentation(doc->editor->sci, + sci_get_current_line(doc->editor->sci) + 1, indent); + g_free(tmp);
sci_end_undo_action(doc->editor->sci);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org