Skip to content

Commit

Permalink
Fix for scroll bug when undoing insert Page
Browse files Browse the repository at this point in the history
in case you scroll down after inserting a page and click undo, you will no longer be scrolled down an additional page
this occurred since the index of the page you where on will have decreased since a page was deleted before the page you where on
  • Loading branch information
p0mm authored and rolandlo committed May 31, 2023
1 parent 3a8bf57 commit d0dcada
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/gui/XournalView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,17 @@ void XournalView::pageChanged(size_t page) {
}

void XournalView::pageDeleted(size_t page) {
size_t currentPage = control->getCurrentPageNo();
const size_t currentPageNo = control->getCurrentPageNo();

viewPages.erase(begin(viewPages) + page);
viewPages.erase(begin(viewPages) + static_cast<long>(page));

layoutPages();
control->getScrollHandler()->scrollToPage(currentPage);

if (currentPageNo > page) {
control->getScrollHandler()->scrollToPage(currentPageNo - 1);
} else {
control->getScrollHandler()->scrollToPage(currentPageNo);
}
}

auto XournalView::getTextEditor() const -> TextEditor* {
Expand Down

0 comments on commit d0dcada

Please sign in to comment.