Bug 26377 Editor copy/paste not working when replacing code
Build 20021114 Attempting to replace some text with clipboard content, it ends up overriding the prefix of the target text only (target is larger than clipboard): select 'argSlotSize' and paste it over selected word argSlotSizeze . It will leave some of the selected word in. testcase: package p; public class Y { static void y(){ int argSlotSize = 1; argSlotSizeze += 2; } }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
Assert.isTrue(pastedText.length() > 1);
			
			String strippedParagraph= stripIndent(pastedText, lineDelimiter);
			
			
			int offset= command.offset;
			int line= document.getLineOfOffset(offset);
			int lineOffset= document.getLineOffset(line);
			
			
			String prefix= document.get(lineOffset, offset - lineOffset);
			String blockIndent= getIndent(document, command);
			String indent= blockIndent == null ? "" : blockIndent + createIndent(1);  
			boolean formatFirstLine= prefix.trim().length() == 0;
			String formattedParagraph= format(strippedParagraph, indent, lineDelimiter, formatFirstLine);
			
			
			if (formatFirstLine)
				command.offset= lineOffset;
			command.text= formattedParagraph;
		} catch (BadLocationException e) {
			JavaPlugin.log(e);			
		}
	}	
	/**
	 * Returns the displayed width of a string, taking in account the displayed tab width.
	 * The result can be compared against the print margin.
	 */
	private static int calculateDisplayedWidth(String string) {
		final int tabWidth= JavaPlugin.getDefault().getPreferenceStore().getInt(JavaSourceViewerConfiguration.PREFERENCE_TAB_WIDTH);