Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63162 Details for
Bug 180683
codeSelect does not work in unicode names like \u0042
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug180683_001.txt (text/plain), 3.67 KB, created by
David Audel
on 2007-04-06 07:00:51 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-04-06 07:00:51 EDT
Size:
3.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v >retrieving revision 1.73 >diff -u -r1.73 ResolveTests.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 16 Mar 2007 18:35:32 -0000 1.73 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 6 Apr 2007 11:00:58 -0000 >@@ -1124,6 +1124,50 @@ > elements > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180683 >+public void testUnicode2() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/B.java", >+ "package test;\n"+ >+ "public class \\u0042 {\n" + >+ " void foo() {\n" + >+ " \\u0042 var = null;\n" + >+ " }\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("42"); >+ int length = "".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "B [in [Working copy] B.java [in test [in src [in Resolve]]]]", >+ elements >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180683 >+public void testUnicode3() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/B.java", >+ "package test;\n"+ >+ "public class \\u0042 {\n" + >+ " void foo() {\n" + >+ " \\u004"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("4"); >+ int length = "".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "", >+ elements >+ ); >+} > /** > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47177 > */ >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.134 >diff -u -r1.134 SelectionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 7 Dec 2006 14:50:05 -0000 1.134 >+++ codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 6 Apr 2007 11:01:00 -0000 >@@ -341,6 +341,8 @@ > int token; > > if(selectionStart > selectionEnd){ >+ // compute end position of the selection >+ int end = selectionEnd + 1 == source.length ? selectionEnd : selectionEnd + 1; > > // compute start position of current line > int currentPosition = selectionStart - 1; >@@ -355,6 +357,16 @@ > while (source[pos] == 'u') { > pos++; > } >+ >+ int endOfUnicode = pos + 3; >+ if (end < endOfUnicode) { >+ if (endOfUnicode < source.length) { >+ end = endOfUnicode; >+ } else { >+ return false; // not enough characters to decode an unicode >+ } >+ } >+ > if ((c1 = ScannerHelper.getNumericValue(source[pos++])) > 15 > || c1 < 0 > || (c2 = ScannerHelper.getNumericValue(source[pos++])) > 15 >@@ -388,7 +400,7 @@ > } > > // compute start and end of the last token >- scanner.resetTo(nextCharacterPosition, selectionEnd + 1 == source.length ? selectionEnd : selectionEnd + 1); >+ scanner.resetTo(nextCharacterPosition, end); > do { > try { > token = scanner.getNextToken();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 180683
: 63162