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 83270 Details for
Bug 208541
[formatter] Formatter does not format whole region/selection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
[proposed patch + new test case] on top v824 - all jdt.core tests OK
patch_for_bug_208541_HEAD(v824)_v06(no_scanner).txt (text/plain), 3.32 KB, created by
Eric Jodet
on 2007-11-19 14:21:48 EST
(
hide
)
Description:
[proposed patch + new test case] on top v824 - all jdt.core tests OK
Filename:
MIME Type:
Creator:
Eric Jodet
Created:
2007-11-19 14:21:48 EST
Size:
3.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java,v >retrieving revision 1.219 >diff -u -r1.219 FormatterRegressionTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 16 Nov 2007 12:11:28 -0000 1.219 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 19 Nov 2007 19:20:24 -0000 >@@ -9627,4 +9627,15 @@ > }; > runTest(codeFormatter, "test688", "A.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=208541 >+ public void test689() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ IRegion[] regions = new IRegion[] { >+ new Region(33, 19) >+ }; >+ runTest(codeFormatter, "test689", "A.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ >+ } > } >Index: workspace/Formatter/test689/A_in.java >=================================================================== >RCS file: workspace/Formatter/test689/A_in.java >diff -N workspace/Formatter/test689/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test689/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package pkg1; >+public class A { >+ int i = 1; >+ >+} >Index: workspace/Formatter/test689/A_out.java >=================================================================== >RCS file: workspace/Formatter/test689/A_out.java >diff -N workspace/Formatter/test689/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test689/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package pkg1; >+public class A { >+ int i = 1; >+ >+} >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v >retrieving revision 1.109 >diff -u -r1.109 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 16 Nov 2007 12:11:24 -0000 1.109 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 19 Nov 2007 19:20:33 -0000 >@@ -728,12 +728,12 @@ > if (span > this.pageWidth) { > return false; > } >- // more than one line selected >- if (span > this.getLineEnd(this.scanner.getLineNumber(offset) + 1)) { >- return false; >- // region is on a single line and CU has more than one line >- } else if (this.lineEnds != null && this.lineEnds.length > 1) { >- return true; >+ if (this.line > 1 && this.lineEnds != null && this.lineEnds.length > 0) { // CU has more than one line >+ if (span >= this.getLineEnd(Util.getLineNumber(offset, this.lineEnds, 0, this.line))) { >+ return false; // more than one line selected, no need to adapt region >+ } else { >+ return true; // single line selected - adapt region >+ } > } > return false; > }
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 208541
:
82969
|
82986
|
83270
|
83555