Mercurial Hosting > editor
diff src/luan_editor/Spell_checker.luan @ 37:b7ff52d45b9a default tip
copy from luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 21 Apr 2025 13:07:29 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/luan_editor/Spell_checker.luan Mon Apr 21 13:07:29 2025 -0600 @@ -0,0 +1,22 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +require "java" +local System = require "java:java.lang.System" +local SpellCheckerLuan = require "java:luan_editor.SpellCheckerLuan" + + +local Spell_checker = {} + +local dir = System.getenv("DICTIONARIES") or error() +SpellCheckerLuan.registerDictionaries( "file:"..dir, "en" ) + +function Spell_checker.spell_check(text_component,spell_check) + local jtext_component = text_component.java + if spell_check then + SpellCheckerLuan.register(jtext_component) + else + SpellCheckerLuan.unregister(jtext_component) + end +end + +return Spell_checker