Skip to content

Commit

Permalink
Merge pull request #1071 from myk002/myk_launcher
Browse files Browse the repository at this point in the history
[gui/launcher] don't pop up a content-free dialog if a command has no output
  • Loading branch information
myk002 authored Apr 9, 2024
2 parents 27edeae + 42b3efa commit 7697613
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions gui/launcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 7697613

Please sign in to comment.