SF.net SVN: geany:[5076] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jul 1 11:49:30 UTC 2010


Revision: 5076
          http://geany.svn.sourceforge.net/geany/?rev=5076&view=rev
Author:   ntrel
Date:     2010-07-01 11:49:30 +0000 (Thu, 01 Jul 2010)

Log Message:
-----------
Add C++ lexer property fold.cpp.comment.explicit (patch sent); set
it disabled.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/scintilla/LexCPP.cxx
    trunk/src/highlighting.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-06-30 12:15:13 UTC (rev 5075)
+++ trunk/ChangeLog	2010-07-01 11:49:30 UTC (rev 5076)
@@ -1,8 +1,16 @@
+2010-07-01  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * scintilla/LexCPP.cxx, src/highlighting.c:
+   Add C++ lexer property fold.cpp.comment.explicit (patch sent); set
+   it disabled.
+
+
 2010-06-30  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/highlighting.c:
-   Re-enable fold.comment for the C lexer - it was disabled to prevent
-   //{ explicit folding, but that also disables stream comments /* */.
+   Re-enable fold.comment for lexers - it was disabled to prevent C
+   //{ explicit folding, but that also disables stream comment folding
+   /* */.
  * tagmanager/tm_workspace.c, tagmanager/get.c:
    Use g_free instead of free (patch by Daniel Marjamäki, thanks).
  * src/editor.c:

Modified: trunk/scintilla/LexCPP.cxx
===================================================================
--- trunk/scintilla/LexCPP.cxx	2010-06-30 12:15:13 UTC (rev 5075)
+++ trunk/scintilla/LexCPP.cxx	2010-07-01 11:49:30 UTC (rev 5076)
@@ -379,10 +379,15 @@
 					   WordList *[], Accessor &styler) {
 
 	// property fold.comment
-	//	This option enables folding multi-line comments and explicit fold points when using the C++ lexer.
+	//	This option enables folding multi-line comments when using the C++ lexer.
+	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+
+	// property fold.cpp.comment.explicit
+	//	Set this property to 0 to disable folding explicit fold points when fold.comment=1.
 	//	Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //}
 	//	at the end of a section that should fold.
-	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+	bool foldCommentExplicit = foldComment &&
+		styler.GetPropertyInt("fold.cpp.comment.explicit", 1) != 0;
 
 	// property fold.preprocessor
 	//	This option enables folding preprocessor directives when using the C++ lexer.
@@ -421,7 +426,7 @@
 				levelNext--;
 			}
 		}
-		if (foldComment && (style == SCE_C_COMMENTLINE)) {
+		if (foldCommentExplicit && (style == SCE_C_COMMENTLINE)) {
 			if ((ch == '/') && (chNext == '/')) {
 				char chNext2 = styler.SafeGetCharAt(i + 2);
 				if (chNext2 == '{') {

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2010-06-30 12:15:13 UTC (rev 5075)
+++ trunk/src/highlighting.c	2010-07-01 11:49:30 UTC (rev 5076)
@@ -779,13 +779,13 @@
 	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDERMIDTAIL,
 		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
 
+	/* set some common defaults */
 	sci_set_property(sci, "fold", "1");
 	sci_set_property(sci, "fold.compact", "0");
 	sci_set_property(sci, "fold.comment", "1");
 	sci_set_property(sci, "fold.preprocessor", "1");
 	sci_set_property(sci, "fold.at.else", "1");
 
-
 	/* bold (3rd argument) is whether to override default foreground selection */
 	if (common_style_set.styling[GCS_SELECTION].bold)
 		SSM(sci, SCI_SETSELFORE, 1, invert(common_style_set.styling[GCS_SELECTION].foreground));
@@ -943,8 +943,10 @@
 	};
 
 	apply_filetype_properties(sci, SCLEX_CPP, ft_id);
+	apply_style_entries(sci, ft_id, styles, G_N_ELEMENTS(styles));
 
-	apply_style_entries(sci, ft_id, styles, G_N_ELEMENTS(styles));
+	/* Disable explicit //{ folding as it can seem like a bug */
+	sci_set_property(sci, "fold.cpp.comment.explicit", "0");
 }
 
 


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