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

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Dec 8 20:41:18 UTC 2009


Revision: 1074
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1074&view=rev
Author:   eht16
Date:     2009-12-08 20:41:17 +0000 (Tue, 08 Dec 2009)

Log Message:
-----------
Remove trailing dots and colons from URIs.

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

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2009-11-30 21:31:57 UTC (rev 1073)
+++ trunk/geany-plugins/addons/ChangeLog	2009-12-08 20:41:17 UTC (rev 1074)
@@ -1,3 +1,9 @@
+2009-12-08  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/ao_openuri.c:
+   Remove trailing dots and colons from URIs.
+
+
 2009-11-30  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/ao_tasks.c:

Modified: trunk/geany-plugins/addons/src/ao_openuri.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_openuri.c	2009-11-30 21:31:57 UTC (rev 1073)
+++ trunk/geany-plugins/addons/src/ao_openuri.c	2009-12-08 20:41:17 UTC (rev 1074)
@@ -199,7 +199,7 @@
 }
 
 
-/* based on g_uri_parse_scheme() but only checks for a scheme, don't return it */
+/* based on g_uri_parse_scheme() but only checks for a scheme, doesn't return it */
 static gboolean ao_uri_has_scheme(const gchar  *uri)
 {
 	const gchar *p;
@@ -249,9 +249,14 @@
 	else
 		text = editor_get_word_at_pos(doc->editor, pos, GEANY_WORDCHARS"@.://-?&%#=");
 
-	/* TODO be more restrictive when handling selections as there are too many hits bynow */
+	/* TODO be more restrictive when handling selections as there are too many hits by now */
 	if (text != NULL && (ao_uri_has_scheme(text) || ao_uri_is_link(text)))
 	{
+		guint len = strlen(text);
+		/* remove trailing dots and colons */
+		if (text[len - 1] == '.' || text[len - 1] == ':')
+			text[len - 1] = '\0';
+
 		setptr(priv->uri, text);
 
 		gtk_widget_show(priv->menu_item_open);


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