SF.net SVN: geany-plugins:[1243] trunk/geanylatex

frlan at users.sourceforge.net frlan at xxxxx
Wed Apr 14 19:06:24 UTC 2010


Revision: 1243
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1243&view=rev
Author:   frlan
Date:     2010-04-14 19:06:24 +0000 (Wed, 14 Apr 2010)

Log Message:
-----------
GeanyLaTeX: Apply given indent when autocompletion \end{} and \endgroup{}

Modified Paths:
--------------
    trunk/geanylatex/ChangeLog
    trunk/geanylatex/src/geanylatex.c

Modified: trunk/geanylatex/ChangeLog
===================================================================
--- trunk/geanylatex/ChangeLog	2010-04-14 18:20:31 UTC (rev 1242)
+++ trunk/geanylatex/ChangeLog	2010-04-14 19:06:24 UTC (rev 1243)
@@ -1,3 +1,9 @@
+2010-04-14  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
+
+ * Ensure basic indent is getting applied on closing command of
+   autocompletion of \begin{} and \begingroup{} feature.
+
+
 2010-04-11  Frank Lanitz  <frank at frank.uvena.de>
 
  * Enabling inserting label on pushing return after typing in label name.

Modified: trunk/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geanylatex/src/geanylatex.c	2010-04-14 18:20:31 UTC (rev 1242)
+++ trunk/geanylatex/src/geanylatex.c	2010-04-14 19:06:24 UTC (rev 1243)
@@ -435,7 +435,7 @@
 					if (sci_get_char_at(sci, pos - (editor_get_eol_char_len (editor) + 1)) == '}'||
 						sci_get_char_at(sci, pos - (editor_get_eol_char_len (editor) + 1)) == ']')
 					{
-						gchar *buf, *construct;
+						gchar *buf, *construct, *indent;
 						/* TODO: Make possible to have longer than a 50 chars environment */
 						gchar env[50];
 						gint line = sci_get_line_from_position(sci, pos - (editor_get_eol_char_len (editor) + 1));
@@ -476,7 +476,8 @@
 									j = 0;
 									i++;
 									while (buf[i] != '}' && j < (sizeof(env) - 1))
-									{   /* this could be done in a shorter way, but so it remains readable ;-) */
+									{   /* this could be done in a shorter way,
+									 	 * but so it remains readable ;-) */
 										env[j] = buf[i];
 										j++;
 										i++;
@@ -498,6 +499,7 @@
 								end_construct = g_strdup_printf("\\end%s{%s}", full_cmd, env);
 								if (strstr(tmp, end_construct) != NULL)
 								{
+									g_warning ("was gefunden");
 									/* Clean up everything and quit as nothing
 									 * needs to be done */
 									g_free(tmp);
@@ -506,18 +508,21 @@
 									return FALSE;
 								}
 								g_free(tmp);
+								g_free(end_construct);
+
 							}
 
-							/* get the indentation */
-							/*if (editor->auto_indent)
-								read_indent(editor, pos); */
-							/* TODO: Find a way respecting ident */
+							/* After we have this, we need to ensure basic
+							 * indent is getting applied on closing command */
+							indent = g_strndup(buf, start);
 
-							construct = g_strdup_printf("\t\n\\end%s{%s}", full_cmd, env);
-
+							/* Now we build up closing string and insert
+							 * it into document */
+							construct = g_strdup_printf("\t\n%s\\end%s{%s}", indent, full_cmd, env);
 							editor_insert_text_block(editor, construct, pos,
 								1, -1, TRUE);
 							g_free(construct);
+							g_free(indent);
 						}
 					}
 				break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list