Allow to compose the fact that a menu entry closes it with normal actions instead of making it a special type of entry

This commit is contained in:
Tissevert 2018-12-14 23:36:15 +01:00
parent b9d8dba0a3
commit 3d59f0dbff

View file

@ -82,11 +82,11 @@ function UI(async, buttons, dom, screen, session) {
},
A: function() {
var entry = config.entries[cursor];
if(entry.close) {
close(m);
}
if(entry.action != undefined) {
entry.action(m);
} else if(entry.quit != undefined) {
close(m);
entry.quit();
}
}
};
@ -108,7 +108,7 @@ function UI(async, buttons, dom, screen, session) {
for(var i = 0; i < config.entries.length; i++) {
var entry;
if(config.entries[i].label != undefined) {
entry = {label: config.entries[i].label, quit: apply(f, config.entries[i].value)};
entry = {label: config.entries[i].label, action: apply(f, config.entries[i].value), close: true};
} else {
entry = {label: '___', action: promptValue(config.entries[i].size, f)};
}