Skip to content

Commit

Permalink
fix: don't insert a new page when page count is at maximum
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
chrrs committed Jul 13, 2024
1 parent dc09dc8 commit 5eb520b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/me/chrr/scribble/mixin/BookEditScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,14 @@ private void deletePage() {

@Unique
private void insertPage() {
this.richPages.add(this.currentPage, RichText.empty());
this.pages.add(this.currentPage, "");
this.dirty = true;
if (this.richPages.size() < 100) {
this.richPages.add(this.currentPage, RichText.empty());
this.pages.add(this.currentPage, "");
this.dirty = true;

this.updateButtons();
this.changePage();
this.updateButtons();
this.changePage();
}
}

// When shift is held down, skip to the last page.
Expand Down

0 comments on commit 5eb520b

Please sign in to comment.