mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-130 fixed
This commit is contained in:
@@ -52,6 +52,9 @@ public class StudyDocumentListener extends DocumentAdapter {
|
||||
if (myTaskWindow != null) {
|
||||
int newLength = myTaskWindow.getLength() + change;
|
||||
myTaskWindow.setLength(newLength <= 0 ? 0 : newLength);
|
||||
if (e.getNewFragment().equals("\n")) {
|
||||
myTaskWindow.setLength(myTaskWindow.getLength() + 1);
|
||||
}
|
||||
}
|
||||
int newEnd = offset + event.getNewLength();
|
||||
int newLine = document.getLineNumber(newEnd);
|
||||
|
||||
@@ -173,7 +173,18 @@ public class TaskFile implements Stateful {
|
||||
for (TaskWindow w : taskWindows) {
|
||||
if ((w.getLine() == line) && (w.getStart() >= oldEndOffsetInLine)) {
|
||||
int distance = w.getStart() - oldEndOffsetInLine;
|
||||
if (lineChange != 0 || newEndOffsetInLine <= w.getStart()) {
|
||||
boolean coveredByPrevTW = false;
|
||||
int prevIndex = w.getIndex() - 1;
|
||||
if (StudyUtils.indexIsValid(prevIndex, taskWindows)) {
|
||||
TaskWindow prevTW = taskWindows.get(prevIndex);
|
||||
if (prevTW.getLine() == line) {
|
||||
int endOffset = prevTW.getStart() + prevTW.getLength();
|
||||
if (endOffset >= newEndOffsetInLine) {
|
||||
coveredByPrevTW = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lineChange != 0 || newEndOffsetInLine <= w.getStart() || coveredByPrevTW) {
|
||||
w.setStart(distance + newEndOffsetInLine);
|
||||
w.setLine(line + lineChange);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user