Fix empty input movement
This commit is contained in:
parent
7ae4315837
commit
d288e0d96c
@ -133,12 +133,7 @@ public final class BlockPosition {
|
|||||||
var it = innerContainers.listIterator(innerContainers.indexOf(container));
|
var it = innerContainers.listIterator(innerContainers.indexOf(container));
|
||||||
if (it.hasPrevious()) {
|
if (it.hasPrevious()) {
|
||||||
var prevContainer = it.previous();
|
var prevContainer = it.previous();
|
||||||
var prevContainerLastBlock = prevContainer.getLastBlock();
|
return prevContainer.getLastPosition();
|
||||||
if (prevContainerLastBlock != null) {
|
|
||||||
return new BlockPosition(prevContainerLastBlock);
|
|
||||||
} else {
|
|
||||||
return new BlockPosition(prevContainer);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var parentContainer = parentBlock.getParentContainer();
|
var parentContainer = parentBlock.getParentContainer();
|
||||||
var blocks = parentContainer.getContentUnsafe();
|
var blocks = parentContainer.getContentUnsafe();
|
||||||
@ -160,12 +155,7 @@ public final class BlockPosition {
|
|||||||
var innerContainers = block.getInnerContainers();
|
var innerContainers = block.getInnerContainers();
|
||||||
if (innerContainers != null) {
|
if (innerContainers != null) {
|
||||||
var lastContainer = innerContainers.get(innerContainers.size() - 1);
|
var lastContainer = innerContainers.get(innerContainers.size() - 1);
|
||||||
var lastBlock = lastContainer.getLastBlock();
|
return lastContainer.getLastPosition();
|
||||||
if (lastBlock != null) {
|
|
||||||
return new BlockPosition(lastBlock);
|
|
||||||
} else {
|
|
||||||
return new BlockPosition(lastContainer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var ref = block.getReference();
|
var ref = block.getReference();
|
||||||
var prevBlock = ref.getPreviousBlock();
|
var prevBlock = ref.getPreviousBlock();
|
||||||
|
@ -126,17 +126,11 @@ public abstract class InputContainer implements GraphicalElement, InputLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prevContainer != null) {
|
if (prevContainer != null) {
|
||||||
var lastBlock = prevContainer.getLastBlock();
|
var lastPosition = prevContainer.getLastPosition();
|
||||||
if (lastBlock != null) {
|
caret.setPosition(lastPosition);
|
||||||
caret.setPosition(new BlockPosition(lastBlock));
|
currentElementToRecompute = null;
|
||||||
currentElementToRecompute = null;
|
removed = false;
|
||||||
removed = false;
|
} else {
|
||||||
} else {
|
|
||||||
caret.setPosition(new BlockPosition(prevContainer));
|
|
||||||
currentElementToRecompute = null;
|
|
||||||
removed = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
caret.setPosition(pos.getPrevious());
|
caret.setPosition(pos.getPrevious());
|
||||||
var parentContainer = block.getParentContainer();
|
var parentContainer = block.getParentContainer();
|
||||||
parentContainer.removeBlockUnsafe(block);
|
parentContainer.removeBlockUnsafe(block);
|
||||||
@ -177,7 +171,7 @@ public abstract class InputContainer implements GraphicalElement, InputLayout {
|
|||||||
if (prev != null) {
|
if (prev != null) {
|
||||||
caret.setPosition(prev);
|
caret.setPosition(prev);
|
||||||
} else {
|
} else {
|
||||||
caret.setPosition(new BlockPosition(root.getLastBlock()));
|
caret.setPosition(root.getLastPosition());
|
||||||
}
|
}
|
||||||
caret.turnOn();
|
caret.turnOn();
|
||||||
caretTime = 0;
|
caretTime = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user