mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52: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:
parent
6bb8abd4e9
commit
6aa0d47d52
2 changed files with 18 additions and 2 deletions
|
@ -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
|
2005-02-10 Bogdan Gheorghe
|
||||||
Fix for 75916: Errors and exceptions in log if you try create a C++ project with
|
Fix for 75916: Errors and exceptions in log if you try create a C++ project with
|
||||||
same name/different case.
|
same name/different case.
|
||||||
|
|
|
@ -266,6 +266,7 @@ public class DefaultCFoldingStructureProvider implements IProjectionListener, IC
|
||||||
|
|
||||||
case ICElement.C_STRUCT:
|
case ICElement.C_STRUCT:
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
|
case ICElement.C_UNION:
|
||||||
collapse= fAllowCollapsing && fCollapseStructures;
|
collapse= fAllowCollapsing && fCollapseStructures;
|
||||||
createProjection= true;
|
createProjection= true;
|
||||||
break;
|
break;
|
||||||
|
@ -300,8 +301,14 @@ public class DefaultCFoldingStructureProvider implements IProjectionListener, IC
|
||||||
if (element instanceof ISourceReference) {
|
if (element instanceof ISourceReference) {
|
||||||
ISourceReference reference= (ISourceReference) element;
|
ISourceReference reference= (ISourceReference) element;
|
||||||
ISourceRange range= reference.getSourceRange();
|
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());
|
int end= fCachedDocument.getLineOfOffset(range.getStartPos() + range.getLength());
|
||||||
if (start < end) {
|
if (start < end) {
|
||||||
int offset= fCachedDocument.getLineOffset(start);
|
int offset= fCachedDocument.getLineOffset(start);
|
||||||
|
|
Loading…
Add table
Reference in a new issue