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

frlan at users.sourceforge.net frlan at xxxxx
Mon May 10 22:48:42 UTC 2010


Revision: 1345
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1345&view=rev
Author:   frlan
Date:     2010-05-10 22:48:42 +0000 (Mon, 10 May 2010)

Log Message:
-----------
GeanyLaTeX: glatex_insert_environment() now has some minimal logic to try to autodetect type of environment

Modified Paths:
--------------
    trunk/geanylatex/src/latexenvironments.c
    trunk/geanylatex/src/latexenvironments.h

Modified: trunk/geanylatex/src/latexenvironments.c
===================================================================
--- trunk/geanylatex/src/latexenvironments.c	2010-05-10 22:12:40 UTC (rev 1344)
+++ trunk/geanylatex/src/latexenvironments.c	2010-05-10 22:48:42 UTC (rev 1345)
@@ -58,6 +58,8 @@
 	"itemize"
 };
 
+
+/* if type == -1 then we will try to autodetect the type */
 void glatex_insert_environment(gchar *environment, gint type)
 {
 	GeanyDocument *doc = NULL;
@@ -97,6 +99,21 @@
 			gchar *tmp = NULL;
 			static const GeanyIndentPrefs *indention_prefs = NULL;
 
+			if (type == -1)
+			{
+				gint i;
+
+				/* First, we check whether we have a known list over here
+				 * an reset type to fit new value*/
+				for (i = 0; i < GLATEX_LIST_END; i++)
+				{
+					if (utils_str_equal(glatex_list_environments[i], environment) == TRUE)
+					{
+						type = GLATEX_ENVIRONMENT_TYPE_LIST;
+						break;
+					}
+				}
+			}
 			pos = sci_get_current_position(doc->editor->sci);
 			len = strlen(environment);
 
@@ -230,8 +247,7 @@
 
 		if (env_string != NULL)
 		{
-			/* Introduce a check whether an enrivonent is a list */
-			glatex_insert_environment(env_string, GLATEX_ENVIRONMENT_TYPE_NONE);
+			glatex_insert_environment(env_string, -1);
 			g_free(env_string);
 		}
 	}

Modified: trunk/geanylatex/src/latexenvironments.h
===================================================================
--- trunk/geanylatex/src/latexenvironments.h	2010-05-10 22:12:40 UTC (rev 1344)
+++ trunk/geanylatex/src/latexenvironments.h	2010-05-10 22:48:42 UTC (rev 1345)
@@ -37,7 +37,8 @@
 enum {
     GLATEX_LIST_DESCRIPTION = 0,
     GLATEX_LIST_ENUMERATE,
-    GLATEX_LIST_ITEMIZE
+    GLATEX_LIST_ITEMIZE,
+    GLATEX_LIST_END
 };
 
 enum {


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