Bug 171: Beim Typeinsert werden Marker jetzt richtig verschoben.

This commit is contained in:
michael 2020-04-02 22:20:31 +02:00
parent a11dc1ab22
commit 0861f74ce7

View File

@ -23,10 +23,6 @@ public class TypeInsertPoint {
}
public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
int offset = additionalOffset.stream().filter((token ->
//token.point.getLine() != point.getLine() && token.point.getCharPositionInLine() <= point.getCharPositionInLine()))
token.point.getStartIndex() <= point.getStartIndex()))
.mapToInt((typeInsertPoint -> typeInsertPoint.insertString.length())).sum();
return new StringBuilder(intoSource).insert(point.getStartIndex()+extraOffset, insertString).toString();
}
@ -48,13 +44,21 @@ public class TypeInsertPoint {
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return this == obj;
/*
if(!(obj instanceof TypeInsertPoint)) {
return false;
}
else {
return ((TypeInsertPoint)obj).point.equals(this.point) &&
((TypeInsertPoint)obj).insertString.equals(this.insertString);
}
return
((TypeInsertPoint)obj).getPositionInCode() == this.getPositionInCode() &&
((TypeInsertPoint)obj).insertString.equals(this.insertString);
}
*/
}
public int hashCode() {
return getPositionInCode() * 11 * insertString.hashCode();
}
public Set<TypeInsertPoint> getAdditionalPoints() {
@ -62,7 +66,7 @@ public class TypeInsertPoint {
}
public String toString() {
return point.toString() + " " + insertString.toString();
return point.getLine() + ":" + point.getCharPositionInLine() + ":" + insertString;
}
public static final class TypeInsertPointPositionComparator implements Comparator<TypeInsertPoint> {