@Override
    @Nullable
    public HistoryElement getSelectedItem() {
        if (selectedItem != null) {
            if (Comparing.equal(selectedItem.expression, myDocument.getCharsSequence())) {
                return selectedItem;
            } else {
                return selectedItem.changeExpression(myDocument.getText().trim());
            }
        }

        assert length == 0;
        return selectedItem;
    }
@Override
    @Nullable
    public HistoryElement getSelectedItem()