1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 334805 - Auto Indentation (CTRL+i) is not correct after function header with pointer return type

This commit is contained in:
Anton Leherbauer 2011-01-20 12:04:38 +00:00
parent c2a4918515
commit 9f2dc0efc8
3 changed files with 28 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -968,4 +968,15 @@ public class CIndenterTest extends BaseUITestCase {
public void testIndentationAfterEnumValueAssignment_Bug324031() throws Exception {
assertIndenterResult();
}
//int * f()
//{
//}
//int * f()
//{
//}
public void testIndentationAfterFunctionHeaderWithPointerReturnType_Bug334805() throws Exception {
assertIndenterResult();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -2021,7 +2021,7 @@ public final class CIndenter {
*/
private boolean skipPointerOperators() {
if (fToken == Symbols.TokenOTHER) {
CharSequence token= getTokenContent();
CharSequence token= getTokenContent().toString().trim();
if (token.length() == 1 && token.charAt(0) == '*' || token.charAt(0) == '&') {
return true;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -217,4 +217,17 @@ public class DocumentCharacterIterator implements CharacterIterator, CharSequenc
throw new IndexOutOfBoundsException();
return new DocumentCharacterIterator(fDocument, getBeginIndex() + start, getBeginIndex() + end);
}
/*
* @see java.lang.CharSequence#toString()
*/
@Override
public String toString() {
int length = length();
char[] chs = new char[length];
for (int i=0; i<length; ++i) {
chs[i] = charAt(i);
}
return new String(chs);
}
}