SF.net SVN: geany: [2732] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Jun 28 15:42:11 UTC 2008


Revision: 2732
          http://geany.svn.sourceforge.net/geany/?rev=2732&view=rev
Author:   eht16
Date:     2008-06-28 08:42:10 -0700 (Sat, 28 Jun 2008)

Log Message:
-----------
Attempt to make editor_find_current_word() Unicode-safe. Note: this can be done better.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-06-28 08:15:18 UTC (rev 2731)
+++ trunk/ChangeLog	2008-06-28 15:42:10 UTC (rev 2732)
@@ -4,6 +4,9 @@
    When opening files remotely using the socket, handle filename
    encoding better and try to auto-detect the used encoding as it
    might be different each time (hopefully closes #2003980).
+ * src/editor.c:
+   Attempt to make editor_find_current_word() Unicode-safe. Note: this
+   can be done better.
 
 
 2008-06-27  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-06-28 08:15:18 UTC (rev 2731)
+++ trunk/src/editor.c	2008-06-28 15:42:10 UTC (rev 2732)
@@ -905,9 +905,12 @@
 	if (wc == NULL)
 		wc = GEANY_WORDCHARS;
 
-	while (startword > 0 && strchr(wc, chunk[startword - 1]))
+	/* the checks for "c < 0" are to allow any Unicode character which should make the code
+	 * a little bit more Unicode safe, anyway, this allows also any Unicode punctuation,
+	 * TODO: improve this code */
+	while (startword > 0 && (strchr(wc, chunk[startword - 1]) || chunk[startword - 1] < 0))
 		startword--;
-	while (chunk[endword] && strchr(wc, chunk[endword]))
+	while (chunk[endword] != 0 && (strchr(wc, chunk[endword]) || chunk[endword] < 0))
 		endword++;
 	if(startword == endword)
 		return;


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



More information about the Commits mailing list