Spellcheck: add the Godot-Hunspell libraries; clip underlines to the field
Prebuilt SpellChecker libraries for Windows, Linux and macOS from Godot-Hunspell (MIT), approved by the user. Underlines of words scrolled out of a narrow field no longer draw past its edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bf031f857c
commit
39ea351571
8 changed files with 30 additions and 1 deletions
BIN
addons/hunspell/bin/hunspell.windows.template_debug.x86_64.dll
Normal file
BIN
addons/hunspell/bin/hunspell.windows.template_debug.x86_64.dll
Normal file
Binary file not shown.
BIN
addons/hunspell/bin/hunspell.windows.template_release.x86_64.dll
Normal file
BIN
addons/hunspell/bin/hunspell.windows.template_release.x86_64.dll
Normal file
Binary file not shown.
BIN
addons/hunspell/bin/libhunspell.linux.template_debug.x86_64.so
Normal file
BIN
addons/hunspell/bin/libhunspell.linux.template_debug.x86_64.so
Normal file
Binary file not shown.
BIN
addons/hunspell/bin/libhunspell.linux.template_release.x86_64.so
Normal file
BIN
addons/hunspell/bin/libhunspell.linux.template_release.x86_64.so
Normal file
Binary file not shown.
BIN
addons/hunspell/bin/libhunspell.macos.template_debug.universal.dylib
Executable file
BIN
addons/hunspell/bin/libhunspell.macos.template_debug.universal.dylib
Executable file
Binary file not shown.
BIN
addons/hunspell/bin/libhunspell.macos.template_release.universal.dylib
Executable file
BIN
addons/hunspell/bin/libhunspell.macos.template_release.universal.dylib
Executable file
Binary file not shown.
22
addons/hunspell/hunspell.gdextension
Normal file
22
addons/hunspell/hunspell.gdextension
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[configuration]
|
||||
|
||||
entry_symbol = "hunspell_library_init"
|
||||
compatibility_minimum = "4.2"
|
||||
|
||||
[libraries]
|
||||
|
||||
windows.debug.x86_64 = "res://addons/hunspell/bin/hunspell.windows.template_debug.x86_64.dll"
|
||||
windows.release.x86_64 = "res://addons/hunspell/bin/hunspell.windows.template_release.x86_64.dll"
|
||||
linux.debug.x86_64 = "res://addons/hunspell/bin/libhunspell.linux.template_debug.x86_64.so"
|
||||
linux.release.x86_64 = "res://addons/hunspell/bin/libhunspell.linux.template_release.x86_64.so"
|
||||
macos.debug = "res://addons/hunspell/bin/libhunspell.macos.template_debug.universal.dylib"
|
||||
macos.release = "res://addons/hunspell/bin/libhunspell.macos.template_release.universal.dylib"
|
||||
|
||||
[dependencies]
|
||||
|
||||
windows.debug.x86_64 = {}
|
||||
windows.release.x86_64 = {}
|
||||
linux.debug.x86_64 = {}
|
||||
linux.release.x86_64 = {}
|
||||
macos.debug = {}
|
||||
macos.release = {}
|
||||
|
|
@ -35,6 +35,8 @@ static func attach(field: Control, p_main: Main) -> void:
|
|||
func _ready() -> void:
|
||||
set_anchors_and_offsets_preset(PRESET_FULL_RECT)
|
||||
mouse_filter = MOUSE_FILTER_IGNORE
|
||||
# Text scrolled out of a narrow field must not be underlined outside it.
|
||||
clip_contents = true
|
||||
add_to_group(GROUP)
|
||||
if field is LineEdit:
|
||||
(field as LineEdit).text_changed.connect(func(_s: String) -> void: recheck())
|
||||
|
|
@ -84,7 +86,12 @@ func _wave(x0: float, x1: float, y: float) -> void:
|
|||
func _segments(r: Vector2i) -> Array:
|
||||
if field is LineEdit:
|
||||
var y := size.y - _line_margin_bottom()
|
||||
return [[_line_x(r.x), _line_x(r.y), y]]
|
||||
var sb := field.get_theme_stylebox("normal")
|
||||
var left := sb.get_margin(SIDE_LEFT) if sb else 0.0
|
||||
var right := size.x - (sb.get_margin(SIDE_RIGHT) if sb else 0.0)
|
||||
var x0 := maxf(left, _line_x(r.x))
|
||||
var x1 := minf(right, _line_x(r.y))
|
||||
return [[x0, x1, y]] if x1 > x0 else []
|
||||
var edit := field as TextEdit
|
||||
var out: Array = []
|
||||
for i in range(r.x, r.y):
|
||||
|
|
|
|||
Loading…
Reference in a new issue