TreeElement (@Nullable TreeElement anchorBefore) { while (anchorBefore != null && anchorBefore.getTreePrev() == null) { CompositeElement parent = anchorBefore.getTreeParent(); if (parent.getTreeParent() == null) break; anchorBefore = parent; } return anchorBefore; }