mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-173600 Provide public API to get changed document lines
This commit is contained in:
@@ -141,6 +141,13 @@ public interface Document extends UserDataHolder {
|
||||
@Contract(pure=true)
|
||||
int getLineEndOffset(int line);
|
||||
|
||||
/**
|
||||
* @return whether the line with the given index has been modified since the document has been saved
|
||||
*/
|
||||
default boolean isLineModified(int line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified text at the specified offset in the document. Line breaks in
|
||||
* the inserted text must be normalized as \n.
|
||||
|
||||
@@ -180,6 +180,12 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
|
||||
return stripTrailingSpaces(project, inChangedLinesOnly, true, new int[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLineModified(int line) {
|
||||
LineSet lineSet = myLineSet;
|
||||
return lineSet != null && lineSet.isModified(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if stripping was completed successfully, false if the document prevented stripping by e.g. caret(s) being in the way
|
||||
*/
|
||||
|
||||
@@ -518,6 +518,11 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLineModified(int line) {
|
||||
return myDelegate.isLineModified(injectedToHostLine(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Segment[] getHostRanges() {
|
||||
|
||||
Reference in New Issue
Block a user