Dave Jarvis' Repositories

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

Add programming terms to English lexicon

AuthorDaveJarvis <email>
Date2022-12-06 18:23:48 GMT-0800
Commit4ff41f7c6d29faf1bd2d34f93b87b346b439c270
Parent248396f
src/main/java/com/keenwrite/ui/spelling/TextEditorSpellChecker.java
final var offset = change.getPosition();
final var position = editor.offsetToPosition( offset, Forward );
- final var paraId = position.getMajor();
- final var paragraph = editor.getParagraph( paraId );
- final var text = paragraph.getText();
+ var paraId = position.getMajor();
+ var paragraph = editor.getParagraph( paraId );
+ var text = paragraph.getText();
+
+ // If the current paragraph is blank, it may mean the caret is at the
+ // start of a new paragraph (i.e., a blank line). Spellcheck the "next"
+ // paragraph, instead.
+ if( text.isBlank() ) {
+ paraId++;
+ paragraph = editor.getParagraph( paraId );
+ text = paragraph.getText();
+ }
// Prevent doubling-up styles.
src/main/resources/lexicons/en.txt
Binary files differ
Delta12 lines added, 3 lines removed, 9-line increase