1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

2005-02-14 Alain Magloire

Fix for PR 84640, do the folding at the start of the ID
	so code like this
	 static int
	 foo () {
	 }
	will start the folding on "foo" and not on "static int"
	* src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java
This commit is contained in:
Alain Magloire 2005-02-14 17:30:16 +00:00
parent 6bb8abd4e9
commit 6aa0d47d52
2 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2005-02-14 Alain Magloire
Fix for PR 84640, do the folding at the start of the ID
so code like this
static int
foo () {
}
will start the folding on "foo" and not on "static int"
* src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java
2005-02-10 Bogdan Gheorghe
Fix for 75916: Errors and exceptions in log if you try create a C++ project with
same name/different case.

View file

@ -266,6 +266,7 @@ public class DefaultCFoldingStructureProvider implements IProjectionListener, IC
case ICElement.C_STRUCT:
case ICElement.C_CLASS:
case ICElement.C_UNION:
collapse= fAllowCollapsing && fCollapseStructures;
createProjection= true;
break;
@ -300,8 +301,14 @@ public class DefaultCFoldingStructureProvider implements IProjectionListener, IC
if (element instanceof ISourceReference) {
ISourceReference reference= (ISourceReference) element;
ISourceRange range= reference.getSourceRange();
int start= fCachedDocument.getLineOfOffset(range.getStartPos());
// We need to start at the id position if not code like this
// static int
// foo()
// { }
// will be fold at the wrong line.
int start= fCachedDocument.getLineOfOffset(range.getIdStartPos());
int end= fCachedDocument.getLineOfOffset(range.getStartPos() + range.getLength());
if (start < end) {
int offset= fCachedDocument.getLineOffset(start);