void (Page lastPage, boolean isLengthIncreased) { isLocalScrollBarStabilized = false; pagesCash.clear(); if (isLengthIncreased) { runCaretAndSelectionListeningTransparentCommand(() -> { documentOfPagesModel.removeLastPage(dataProvider.getProject()); }); isAllowedToFollowTheEndOfFile = true; } else { runCaretAndSelectionListeningTransparentCommand(() -> { documentOfPagesModel.removeAllPages(dataProvider.getProject()); }); } if (lastPage != null) { pagesCash.add(lastPage); } update(); }