SF.net SVN: geany-plugins:[1465] trunk/geany-plugins/addons

frlan at users.sourceforge.net frlan at xxxxx
Sat Jun 26 16:44:34 UTC 2010


Revision: 1465
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1465&view=rev
Author:   frlan
Date:     2010-06-26 16:44:34 +0000 (Sat, 26 Jun 2010)

Log Message:
-----------
Only use part of inserted tag until first white space character for closing tag so e.g. inserting 'span class=foo"' is working properly.

Modified Paths:
--------------
    trunk/geany-plugins/addons/ChangeLog
    trunk/geany-plugins/addons/src/ao_xmltagging.c

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2010-06-26 16:44:05 UTC (rev 1464)
+++ trunk/geany-plugins/addons/ChangeLog	2010-06-26 16:44:34 UTC (rev 1465)
@@ -1,3 +1,10 @@
+2010-06-26  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
+
+ * src/ao_xmltagging.c:
+   Only use part of inserted tag until first white space character for
+   closing tag so e.g. inserting 'span class=foo"' is working properly.
+
+
 2010-05-30  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/addons.c:

Modified: trunk/geany-plugins/addons/src/ao_xmltagging.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_xmltagging.c	2010-06-26 16:44:05 UTC (rev 1464)
+++ trunk/geany-plugins/addons/src/ao_xmltagging.c	2010-06-26 16:44:34 UTC (rev 1465)
@@ -83,8 +83,24 @@
 			tag = g_strdup(gtk_entry_get_text(GTK_ENTRY(textbox)));
 			if (NZV(tag))
 			{
+				gint end = 0;
+				const gchar *end_tag;
+				/* We try to find a space inside the inserted tag as we
+				 * only need to close the tag with part until first space.
+				 * */
+				while (!g_ascii_isspace(tag[end]) && tag[end] != '\0')
+					end++;
+
+				if (end > 0)
+				{
+					end_tag = g_strndup(tag, end);
+				}
+				else
+				{
+					end_tag = tag;
+				}
 				replacement = g_strconcat("<", tag, ">",
-								selection, "</", tag, ">", NULL);
+								selection, "</", end_tag, ">", NULL);
 			}
 
 			sci_replace_sel(doc->editor->sci, replacement);
@@ -92,7 +108,6 @@
 			g_free(selection);
 			g_free(replacement);
 		}
-
 		gtk_widget_destroy(dialog);
 	}
 }


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