mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
IDEA-123286 diff: fix off-by-one in the current document too
This commit is contained in:
@@ -613,6 +613,10 @@ public class LineStatusTracker {
|
||||
return getRange(range.getType(), range.getUOffset1(), range.getUOffset2(), Range.INSERTED, myUpToDateDocument, false);
|
||||
}
|
||||
|
||||
TextRange getCurrentTextRangeWithEndSymbol(Range range) {
|
||||
return getRange(range.getType(), range.getOffset1(), range.getOffset2(), Range.DELETED, myDocument, true);
|
||||
}
|
||||
|
||||
// a hack
|
||||
TextRange getUpToDateRangeWithEndSymbol(Range range) {
|
||||
return getRange(range.getType(), range.getUOffset1(), range.getUOffset2(), Range.INSERTED, myUpToDateDocument, true);
|
||||
|
||||
@@ -27,8 +27,8 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author irengrig
|
||||
*/
|
||||
* @author irengrig
|
||||
*/
|
||||
public class ShowLineStatusRangeDiffAction extends BaseLineStatusRangeAction {
|
||||
public ShowLineStatusRangeDiffAction(final LineStatusTracker lineStatusTracker, final Range range, final Editor editor) {
|
||||
super(VcsBundle.message("action.name.show.difference"), AllIcons.Actions.Diff, lineStatusTracker, range);
|
||||
@@ -54,9 +54,12 @@ public class ShowLineStatusRangeDiffAction extends BaseLineStatusRangeAction {
|
||||
return new DiffRequest(myLineStatusTracker.getProject()) {
|
||||
@NotNull
|
||||
public DiffContent[] getContents() {
|
||||
return new DiffContent[]{createDiffContent(myLineStatusTracker.getUpToDateDocument(),
|
||||
myLineStatusTracker.getUpToDateRangeWithEndSymbol(myRange), null),
|
||||
createDiffContent(myLineStatusTracker.getDocument(), myLineStatusTracker.getCurrentTextRange(myRange),
|
||||
return new DiffContent[]{
|
||||
createDiffContent(myLineStatusTracker.getUpToDateDocument(),
|
||||
myLineStatusTracker.getUpToDateRangeWithEndSymbol(myRange),
|
||||
null),
|
||||
createDiffContent(myLineStatusTracker.getDocument(),
|
||||
myLineStatusTracker.getCurrentTextRangeWithEndSymbol(myRange),
|
||||
myLineStatusTracker.getVirtualFile())};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user