diff --git a/src/main/java/com/muedsa/intellij/textReader/composes/ReaderWindow.java b/src/main/java/com/muedsa/intellij/textReader/composes/ReaderWindow.java index 115b679..f58953a 100644 --- a/src/main/java/com/muedsa/intellij/textReader/composes/ReaderWindow.java +++ b/src/main/java/com/muedsa/intellij/textReader/composes/ReaderWindow.java @@ -358,6 +358,7 @@ private void setTextContent(){ textContent.setText(text); noBlankChapterText = text.replaceAll("\\s*", ""); textContent.setCaretPosition(0); + positionInChapter = 0; } } @@ -370,12 +371,7 @@ public String nextLine(){ int lineSize = (int)lineSizeSpinner.getValue(); if(lineSize > 0){ if(StringUtils.isEmpty(noBlankChapterText) || positionInChapter > noBlankChapterText.length()){ - if(nextChapter()){ - positionInChapter = 0; - noBlankChapterText = textContent.getText(); - }else{ - return "end!"; - } + nextChapter(); } String line = StringUtils.mid(noBlankChapterText, positionInChapter, lineSize); positionInChapter += lineSize; @@ -390,15 +386,12 @@ public String nextLine(){ } } - private boolean nextChapter(){ + private void nextChapter(){ int count = titleList.getItemsCount(); int index = titleList.getSelectedIndex() + 1; if(index + 1 <= count){ titleList.setSelectedIndex(index); setTextContent(); - return true; - }else{ - return false; } } }