Skip to content

Commit 876a2ea

Browse files
authored
Fix Create new member record preview: formatting is off (eclipse-jdt#2184)
Two superflous newlines (`<br>`) where causing the bold font styling to be place on the wrong chars. fixes eclipse-jdt#2183
1 parent 7e6d247 commit 876a2ea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/NewCUUsingWizardProposal.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ private ITypeBinding getPossibleSuperTypeBinding(ASTNode node) {
512512
@Override
513513
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
514514
StringBuilder buf= new StringBuilder();
515+
boolean noSpacingNeeded = false;
515516
switch (fTypeKind) {
516517
case K_CLASS:
517518
buf.append(CorrectionMessages.NewCUCompletionUsingWizardProposal_createclass_info);
@@ -525,9 +526,14 @@ public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
525526
case K_ANNOTATION:
526527
buf.append(CorrectionMessages.NewCUCompletionUsingWizardProposal_createannotation_info);
527528
break;
529+
default:
530+
noSpacingNeeded = true;
531+
}
532+
// #2183: newlines at the start of the preview String mess with the formatting
533+
if (!noSpacingNeeded) {
534+
buf.append("<br>"); //$NON-NLS-1$
535+
buf.append("<br>"); //$NON-NLS-1$
528536
}
529-
buf.append("<br>"); //$NON-NLS-1$
530-
buf.append("<br>"); //$NON-NLS-1$
531537
if (fTypeContainer instanceof IType) {
532538
buf.append(CorrectionMessages.NewCUCompletionUsingWizardProposal_tooltip_enclosingtype);
533539
} else {

0 commit comments

Comments
 (0)