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
1 changed files with 4 additions and 4 deletions

View File

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