Skip to content

Commit

Permalink
recover gracefully when saved frame positions are offscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Aug 27, 2023
1 parent 734ed2c commit 3a50772
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Template for new versions:
- `caravan`: Apply both import and export trade agreement price adjustments to items being both bought or sold to align with how vanilla DF calculates prices
- `suspendmanager`: Improve the detection on "T" and "+" shaped high walls
- `starvingdead`: ensure sieges end properly when undead siegers starve
- `gui/launcher`, `gui/gm-editor`: recover gracefully when the saved frame position is now offscreen

## Misc Improvements
- `devel/lsmem`: added support for filtering by memory addresses and filenames
Expand Down
6 changes: 6 additions & 0 deletions gui/gm-editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ end
function GmEditorUi:init(args)
if not next(self.frame) then
self.frame = {w=80, h=50}
else
for k,v in pairs(self.frame) do
if v < 0 then
self.frame[k] = 0
end
end
end

-- don't appear directly over the current window
Expand Down
7 changes: 7 additions & 0 deletions gui/launcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ end

-- removes duplicate existing history lines and adds the given line to the front
local function add_history(hist, hist_set, line)
line = line:trim()
if hist_set[line] then
for i,v in ipairs(hist) do
if v == line then
Expand Down Expand Up @@ -586,6 +587,12 @@ function LauncherUI:init(args)
new_frame = config.data
if not next(new_frame) then
new_frame = {w=110, h=36}
else
for k,v in pairs(new_frame) do
if v < 0 then
new_frame[k] = 0
end
end
end
end
main_panel.frame = new_frame
Expand Down

0 comments on commit 3a50772

Please sign in to comment.