save and reload up to 20 history entries
This commit is contained in:
parent
8fe1cf807d
commit
246ce973ec
1 changed files with 18 additions and 0 deletions
|
@ -288,3 +288,21 @@ var search = func(n, s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
|
foreach (var p; props.globals.getNode("/sim/gui/prop-key-handler/history", 1).getChildren("entry"))
|
||||||
|
append(history, p.getValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
_setlistener("/sim/signals/exit", func {
|
||||||
|
var max = props.initNode("/sim/gui/prop-key-handler/history-max-size", 20).getValue();
|
||||||
|
if (size(history) > max)
|
||||||
|
history = subvec(history, size(history) - max);
|
||||||
|
forindex (var i; history) {
|
||||||
|
var p = props.globals.getNode("/sim/gui/prop-key-handler/history", 1).getChild("entry", i, 1);
|
||||||
|
p.setValue(history[i]);
|
||||||
|
p.setAttribute("userarchive", 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue