More work on LibreOffice support.

This commit is contained in:
Storm Dragon committed 2026-10-15 00:50:49 -04:00
1 parent e0c8c6198c
commit 4ac59d4ced
25 files changed
+392 -57

No files matched your search

+19
View File
@@ -4,6 +4,11 @@
package atspi
import (
"strings"
"unicode/utf8"
)
// LibreOfficeContext is bounded, copied metadata from the native owner. It
// describes Calc's cell and temporary editor objects, without native handles.
// Presentation and application policy must not query the provider themselves.
@@ -15,6 +20,7 @@ type LibreOfficeContext struct {
ContainerFocused bool
CellText string
Coordinates string
Formula string
}
// IsLibreOfficeProcess uses /proc identity verified by the adapter. An
@@ -22,3 +28,16 @@ type LibreOfficeContext struct {
func IsLibreOfficeProcess(process string) bool {
return process == "soffice.bin"
}
// Preserve spaces inside formula string literals and keep the beginning when
// bounding long expressions. Text context's default suffix is for caret lines.
func sanitizeLibreOfficeFormula(value string) string {
value = strings.ToValidUTF8(value, "�")
if len(value) > maxSnapshotFieldLength {
value = value[:maxSnapshotFieldLength]
for !utf8.ValidString(value) {
value = value[:len(value)-1]
}
}
return sanitizeTextContext(value)
}