From 3d59f0dbff4d53c5ffb71dbaf6eb5feea4d403a4 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Fri, 14 Dec 2018 23:36:15 +0100 Subject: [PATCH] Allow to compose the fact that a menu entry closes it with normal actions instead of making it a special type of entry --- src/ui.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui.js b/src/ui.js index 68a0b5c..6b9e4bd 100644 --- a/src/ui.js +++ b/src/ui.js @@ -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)}; }