1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 272006 - [CodeFormatter] DBCS3.5: New Class wizard truncates first DBCS character in class name and namespace

This commit is contained in:
Anton Leherbauer 2009-04-24 06:43:45 +00:00
parent 3cf528d841
commit 56144f3f01
3 changed files with 35 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (c) 2004, 2009 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
@ -196,7 +196,7 @@ public class SimpleScanner {
digit = c - 'A' + 10;
break;
default:
ungetChar(c);
internalUngetChar(c);
return unicode;
}
fUniversalCharBuffer.append((char) c);
@ -205,16 +205,21 @@ public class SimpleScanner {
} while (true);
}
private void internalUngetChar(int c) {
fTokenBuffer.deleteCharAt(fTokenBuffer.length() - 1);
fContext.pushUndo(c);
}
protected void ungetChar(int c) {
if (c < 256) {
fTokenBuffer.deleteCharAt(fTokenBuffer.length() - 1);
fContext.pushUndo(c);
} else {
if (c < 256 || c == fTokenBuffer.charAt(fTokenBuffer.length() - 1)) {
internalUngetChar(c);
} else if (fUniversalCharBuffer.length() > 0) {
char[] chs = fUniversalCharBuffer.toString().toCharArray();
for (int i = chs.length-1; i >= 0; --i) {
fTokenBuffer.deleteCharAt(fTokenBuffer.length() - 1);
fContext.pushUndo(chs[i]);
internalUngetChar(chs[i]);
}
} else {
internalUngetChar(c);
}
}

View file

@ -0,0 +1,3 @@
#Thu Apr 23 17:28:18 CEST 2009
eclipse.preferences.version=1
encoding//ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java=UTF-8

View file

@ -1167,7 +1167,7 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testFormatterProblemsWithTypename_Bug269590() throws Exception {
assertFormatterResult();
}
//void
//foo();
//int*
@ -1180,4 +1180,22 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testPreserveNewlineBetweenTypeAndFunctionDeclarator() throws Exception {
assertFormatterResult();
}
//class 大大大大
//{
//public:
// 大大大大();
// virtual ~大大大大();
//};
//class 大大大大
//{
//public:
// 大大大大();
// virtual ~大大大大();
//};
public void testFormatGeneratedClass_Bug272006() throws Exception {
assertFormatterResult();
}
}