From 42b3efa2d52305790e8e2731adb6f4e266c182aa Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 8 Apr 2024 17:58:23 -0700 Subject: [PATCH] don't pop up a content-free dialog if a command has no output when run from minimal mode --- changelog.txt | 1 + gui/launcher.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 88910ee329..39f5b80fd6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -42,6 +42,7 @@ Template for new versions: - `armoks-blessing`: fix error when making class "Normal" attributes legendary - `emigration`: remove units from burrows when they emigrate - `agitation-rebalance`: fix calculated percent chance of cavern invasion +- `gui/launcher`: don't pop up a result dialog if a command run from minimal mode has no output ## Misc Improvements - `gui/reveal`: show aquifers even when not in mining mode diff --git a/gui/launcher.lua b/gui/launcher.lua index 25e21345b5..8f20c6e94e 100644 --- a/gui/launcher.lua +++ b/gui/launcher.lua @@ -1080,16 +1080,21 @@ function LauncherUI:run_command(reappear, command) print() print(output) end + output = output:gsub('\t', ' ') -- if we displayed a different screen, don't come back up, even if reappear -- is true, so the user can interact with the new screen. local _,parent_addr = self._native.parent:sizeof() if self.minimal or parent_addr ~= prev_parent_addr then reappear = false + if self.minimal and #output > 0 then + dialogs.showMessage(TITLE, output) + end end if #output == 0 then output = 'Command finished successfully' - else - output = output:gsub('\t', ' ') + end + if not output:endswith('\n') then + output = output .. '\n' end output = ('> %s\n\n%s'):format(command, output) end @@ -1099,9 +1104,6 @@ function LauncherUI:run_command(reappear, command) if not reappear then self:dismiss() - if self.minimal and #output > 0 then - dialogs.showMessage(TITLE, output) - end end end