Nasal/prop_key_handler.nas: fixed couple of issues in search ('?') code.
Don't include initial '/' in search string. Don't fail if a property value is -Nan.
This commit is contained in:
parent
96fd272a51
commit
c280ff3fc4
1 changed files with 12 additions and 3 deletions
|
@ -134,6 +134,7 @@ var handle_key = func(key, shift) {
|
||||||
return 0; # pass other funny events
|
return 0; # pass other funny events
|
||||||
|
|
||||||
} elsif (key == `?` and state.value == nil) {
|
} elsif (key == `?` and state.value == nil) {
|
||||||
|
text = substr(text, 1);
|
||||||
print("\n-- property search: '", text, "' ----------------------------------");
|
print("\n-- property search: '", text, "' ----------------------------------");
|
||||||
search(props.globals, text);
|
search(props.globals, text);
|
||||||
print("-- done --\n");
|
print("-- done --\n");
|
||||||
|
@ -344,8 +345,16 @@ var print_prop = func(n) {
|
||||||
var search = func(n, s) {
|
var search = func(n, s) {
|
||||||
if (find(s, n.getPath()) >= 0)
|
if (find(s, n.getPath()) >= 0)
|
||||||
print_prop(n);
|
print_prop(n);
|
||||||
elsif (n.getType() != "NONE" and find(s, "" ~ n.getValue()) >= 0)
|
elsif (n.getType() != "NONE") {
|
||||||
|
var f = call(func { return find(s, "" ~ n.getValue());}, nil, var err=[]);
|
||||||
|
if (size(err)) {
|
||||||
|
# This can happen if value is '-nan'.
|
||||||
|
printf("got error from n.getValue() for n.getPath()=%s", n.getPath());
|
||||||
|
}
|
||||||
|
else if (f >= 0) {
|
||||||
print_prop(n);
|
print_prop(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach (var c; n.getChildren())
|
foreach (var c; n.getChildren())
|
||||||
search(c, s);
|
search(c, s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue