56 lines
1.5 KiB
Go
56 lines
1.5 KiB
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package app
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
func (a *application) reading_regions_changed() {
|
|
a.spellFeedback++
|
|
if a.cues != nil {
|
|
a.cues.Clear_progress()
|
|
}
|
|
// Changing a filter must not make an old, newly exposed prompt restore
|
|
// speech. Observe it now as a baseline, without presenting the result.
|
|
a.prompts.Observe(a.engine.Automatic_snapshot())
|
|
}
|
|
|
|
// remote_window runs only after the existing section-specific authorization.
|
|
// Python accepts these operations in both COMMAND and SETTING sections. Remote
|
|
// coordinates are zero-based inclusive cells, unlike spoken row/column reports.
|
|
func (a *application) remote_window(text string) (string, bool) {
|
|
fields := strings.Fields(text)
|
|
if len(fields) == 0 {
|
|
return "", false
|
|
}
|
|
switch strings.ToUpper(fields[0]) {
|
|
case "WINDOW":
|
|
if len(fields) != 5 {
|
|
return "WINDOW requires four coordinates: x1 y1 x2 y2", true
|
|
}
|
|
var coordinates [4]int
|
|
for index := range coordinates {
|
|
value, err := strconv.Atoi(fields[index+1])
|
|
if err != nil {
|
|
return "Invalid WINDOW coordinate", true
|
|
}
|
|
coordinates[index] = value
|
|
}
|
|
if err := a.engine.Set_window(coordinates[0], coordinates[1], coordinates[2], coordinates[3]); err != nil {
|
|
return err.Error(), true
|
|
}
|
|
case "RESETWINDOW":
|
|
if len(fields) != 1 {
|
|
return "RESETWINDOW does not accept coordinates", true
|
|
}
|
|
a.engine.Clear_window()
|
|
default:
|
|
return "", false
|
|
}
|
|
a.reading_regions_changed()
|
|
return "", true
|
|
}
|