Bug 46875 [typing] Tabs are messed up
When I type code that has string literals in it, and press enter to move the string literal to the next line, the tab logic seems strange. e.g. String twoLines = "System Contains Many Defects,Systemet innehaller manga fel\n"+"Stories Are Too Complicated,Stories ar for komplicerade"; Move the cursor after + and press enter. It somehow moves the new line to column 0, while I'd expect it to align with the first line. If you try this with a single string, the bug will still be seen. Interestingly, when I am within a method's parantheses, the behavior is different. e.g. assertEquals( "converted data", "Systemet+innehaller+manga+fel|Stories+ar+for+komplicerade",convertedData .toString() ); Note, the two lines within have a single tab each. Now position the cursor on convertedData and press enter - while I'd expect it to line up with the previous line (two tabs), the IDE adds three tabs. Now here's the one which really annoys me: assertEquals( There is one tab before assertEquals. Press enter after the paranthesis. Three tabs are inexplicably put in. I would expect only two. I am assuming these are bugs as previous releases had the right behavior. Regards, Somik
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaStringAutoIndentStrategy.java
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.internal.ui.text.java;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultAutoIndentStrategy;
import org.eclipse.jface.text.DocumentCommand;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.texteditor.ITextEditorExtension3;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
 * Auto indent strategy for java strings
 */
public class JavaStringAutoIndentStrategy extends DefaultAutoIndentStrategy {