Mercurial Hosting > editor
comparison src/luan_editor/Spell_checker.luan @ 37:b7ff52d45b9a
copy from luan
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 21 Apr 2025 13:07:29 -0600 |
| parents | |
| children | 99ebb6176d2f |
comparison
equal
deleted
inserted
replaced
| 36:0a8865de3d53 | 37:b7ff52d45b9a |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | |
| 2 local error = Luan.error | |
| 3 require "java" | |
| 4 local System = require "java:java.lang.System" | |
| 5 local SpellCheckerLuan = require "java:luan_editor.SpellCheckerLuan" | |
| 6 | |
| 7 | |
| 8 local Spell_checker = {} | |
| 9 | |
| 10 local dir = System.getenv("DICTIONARIES") or error() | |
| 11 SpellCheckerLuan.registerDictionaries( "file:"..dir, "en" ) | |
| 12 | |
| 13 function Spell_checker.spell_check(text_component,spell_check) | |
| 14 local jtext_component = text_component.java | |
| 15 if spell_check then | |
| 16 SpellCheckerLuan.register(jtext_component) | |
| 17 else | |
| 18 SpellCheckerLuan.unregister(jtext_component) | |
| 19 end | |
| 20 end | |
| 21 | |
| 22 return Spell_checker |
