SF.net SVN: geany:[2816] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Jul 25 09:51:09 UTC 2008


Revision: 2816
          http://geany.svn.sourceforge.net/geany/?rev=2816&view=rev
Author:   eht16
Date:     2008-07-25 09:51:08 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
Fix wrong checks when determining whether a style is a PHP style (style SCE_HPHP_COMPLEX_VARIABLE was ignored, closes #2027235).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-07-25 09:49:54 UTC (rev 2815)
+++ trunk/ChangeLog	2008-07-25 09:51:08 UTC (rev 2816)
@@ -7,6 +7,9 @@
    Update waf to its latest SVN rev and exclude some unused modules
    which makes it another 20 KB smaller.
    Update waf script to reflect waf API changes(module Install removed).
+ * src/editor.c:
+   Fix wrong checks when determining whether a style is a PHP style
+   (style SCE_HPHP_COMPLEX_VARIABLE was ignored, closes #2027235).
 
 
 2008-07-24  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-07-25 09:49:54 UTC (rev 2815)
+++ trunk/src/editor.c	2008-07-25 09:51:08 UTC (rev 2816)
@@ -215,6 +215,18 @@
 }
 
 
+static gboolean is_style_php(gint style)
+{
+	if ((style >= SCE_HPHP_DEFAULT && style <= SCE_HPHP_OPERATOR) ||
+		style == SCE_HPHP_COMPLEX_VARIABLE)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
 typedef struct SCNotification SCNotification;
 
 static void fold_symbol_click(ScintillaObject *sci, SCNotification *nt)
@@ -1319,7 +1331,7 @@
 	if (ft_id == GEANY_FILETYPES_PHP)
 	{
 		/* use entity completion when style is outside of PHP styles */
-		if (style < SCE_HPHP_DEFAULT || style > SCE_HPHP_OPERATOR)
+		if (! is_style_php(style))
 			return TRUE;
 	}
 
@@ -1738,8 +1750,7 @@
 	if (editor->document->file_type->id == GEANY_FILETYPES_PHP)
 	{
 		gint style = sci_get_style_at(sci, pos);
-		if (style != SCE_HPHP_SIMPLESTRING && style != SCE_HPHP_HSTRING &&
-			style <= SCE_HPHP_OPERATOR && style >= SCE_HPHP_DEFAULT)
+		if (is_style_php(style) && style != SCE_HPHP_SIMPLESTRING && style != SCE_HPHP_HSTRING)
 			return FALSE;
 	}
 
@@ -1889,7 +1900,6 @@
 	g_free(linebuf);
 }
 
-
 /* set toggle to TRUE if the caller is the toggle function, FALSE otherwise
  * returns the amount of uncommented single comment lines, in case of multi line uncomment
  * it returns just 1 */
@@ -1930,8 +1940,7 @@
 	line_start = sci_get_position_from_line(doc->editor->sci, first_line);
 	if (ft->id == GEANY_FILETYPES_PHP)
 	{
-		if (sci_get_style_at(doc->editor->sci, line_start) < 118 ||
-			sci_get_style_at(doc->editor->sci, line_start) > 127)
+		if (! is_style_php(sci_get_style_at(doc->editor->sci, line_start)))
 			ft = filetypes[GEANY_FILETYPES_XML];
 	}
 
@@ -2002,8 +2011,7 @@
 					case SCLEX_XML:
 					case SCLEX_HTML:
 					{
-						if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
-							sci_get_style_at(doc->editor->sci, line_start) <= 127)
+						if (is_style_php(sci_get_style_at(doc->editor->sci, line_start)))
 							style_comment = SCE_HPHP_COMMENT;
 						else style_comment = SCE_H_COMMENT;
 						break;
@@ -2081,8 +2089,7 @@
 	first_line_start = sci_get_position_from_line(doc->editor->sci, first_line);
 	if (ft->id == GEANY_FILETYPES_PHP)
 	{
-		if (sci_get_style_at(doc->editor->sci, first_line_start) < 118 ||
-			sci_get_style_at(doc->editor->sci, first_line_start) > 127)
+		if (! is_style_php(sci_get_style_at(doc->editor->sci, first_line_start)))
 			ft = filetypes[GEANY_FILETYPES_XML];
 	}
 
@@ -2150,8 +2157,7 @@
 				case SCLEX_XML:
 				case SCLEX_HTML:
 				{
-					if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
-						sci_get_style_at(doc->editor->sci, line_start) <= 127)
+					if (is_style_php(sci_get_style_at(doc->editor->sci, line_start)))
 						style_comment = SCE_HPHP_COMMENT;
 					else style_comment = SCE_H_COMMENT;
 					break;
@@ -2259,8 +2265,7 @@
 	line_start = sci_get_position_from_line(doc->editor->sci, first_line);
 	if (ft->id == GEANY_FILETYPES_PHP)
 	{
-		if (sci_get_style_at(doc->editor->sci, line_start) < 118 ||
-			sci_get_style_at(doc->editor->sci, line_start) > 127)
+		if (! is_style_php(sci_get_style_at(doc->editor->sci, line_start)))
 			ft = filetypes[GEANY_FILETYPES_XML];
 	}
 
@@ -2324,8 +2329,7 @@
 					case SCLEX_XML:
 					case SCLEX_HTML:
 					{
-						if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
-							sci_get_style_at(doc->editor->sci, line_start) <= 127)
+						if (is_style_php(sci_get_style_at(doc->editor->sci, line_start)))
 							style_comment = SCE_HPHP_COMMENT;
 						else style_comment = SCE_H_COMMENT;
 						break;


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