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
default :
						tokenBuffer.append(c);
				}
			}
			buffer.append(tokenBuffer);
		}
		return buffer.toString();
	}
	/**
	 * Creates a new Java string auto indent strategy for the given document partitioning.
	 * 
	 * @param partitioning the document partitioning
	 */
	public JavaStringAutoIndentStrategy(String partitioning) {
		super();
		fPartitioning= partitioning;
	}
	
	private boolean isLineDelimiter(IDocument document, String text) {
		String[] delimiters= document.getLegalLineDelimiters();
		if (delimiters != null)
			return TextUtilities.equals(delimiters, text) > -1;
		return false;
	}
	
	private String getLineIndentation(IDocument document, int offset) throws BadLocationException {
		
		int adjustedOffset= (offset == document.getLength() ? offset  - 1 : offset);
		IRegion line= document.getLineInformationOfOffset(adjustedOffset);
		int start= line.getOffset();