Scripts: ScriptUI dialogs refuse look-alike containers, noecho fields and stale descriptions

- An answer step with an empty control matches only an unnamed control whose
  text is empty, not the first unnamed control.
- add() and add("item") on an object made to look like a container or list
  throw a TypeError and charge nothing to the dialog's limits.
- A new list's initial items are read through ordinary property access, so an
  index getter gives its value.
- findElement() keeps the controls it has still to look at rooted while a
  name getter runs, and skips a control the element no longer holds.
- A close() that onClose calls before it returns false belongs to the close it
  refuses; the dialog waits for the next event.
- show() throws for an edittext with noecho before the dialog opens.
- show() reads the dialog again when a getter adds or removes a control after
  the controls were read, and throws when it changes again.
- An edit field takes at most 32,768 characters while it is typed.
This commit is contained in:
dotCooCoo committed 2026-11-25 14:41:28 -08:00
1 parent 3ede7a59f4
commit 9dc197b4e4
7 files changed
+200 -32

No files matched your search

+1 -1
View File
@@ -198,7 +198,7 @@ impl ScriptUiDialog {
/// whose text is `control`.
pub fn find(&self, control: &str) -> Option<usize> {
let by = |name: bool| {
let hit = |n: &UiNode| if name { n.name == control } else { n.name.is_empty() && n.text == control };
let hit = |n: &UiNode| if name { !control.is_empty() && n.name == control } else { n.name.is_empty() && n.text == control };
self.nodes.iter().enumerate().skip(1).find(|(_, n)| hit(n)).map(|(i, _)| i)
};
by(true).or_else(|| by(false))