Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Fixes cutting text at the end of a file

AuthorDaveJarvis <email>
Date2023-01-03 22:52:09 GMT-0800
Commit41f0362cfdd32ddc3d4a70dafe5f9bc15abd5a63
Parentfdfdc0b
Delta4 lines added, 3 lines removed, 1-line increase
src/main/java/com/keenwrite/ui/spelling/TextEditorSpellChecker.java
// paragraph, instead.
if( text.isBlank() ) {
- paraId++;
+ final var paragraphs = editor.getParagraphs().size();
+
+ paraId = Math.min( paraId + 1, paragraphs - 1 );
paragraph = editor.getParagraph( paraId );
text = paragraph.getText();
* @param editor The document (or portions thereof) to spellcheck.
* @param text Look up words for this text in the lexicon.
- * @param paraId Set to -1 to apply resulting style spans to the entire
- * text.
+ * @param paraId Set to -1 to apply resulting style spans to the entire text.
*/
private void spellcheck(