Skip to content

Commit

Permalink
Save on pressing enter in filename box
Browse files Browse the repository at this point in the history
  • Loading branch information
sturnclaw committed Aug 22, 2024
1 parent d48ef4e commit 0b9a251
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions data/pigui/modules/saveloadgame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,19 @@ function SaveLoadWindow:drawSaveFooter()
ui.sameLine()
ui.nextItemWidth(ui.getContentRegion().x - buttonWidths)

local savePath, changed
local savePath, confirmed

ui.withStyleVars({ FramePadding = ui.theme.styles.ButtonPadding }, function()
savePath, changed = ui.inputText("##savePath", self.savePath, {})
savePath, confirmed = ui.inputText("##savePath", self.savePath, { "EnterReturnsTrue" })
end)

if changed then
if savePath ~= self.savePath then
self:message("onSavePathChanged", savePath)
end

if confirmed then
self:message("saveToFilePath")
end
else
ui.dummy(Vector2(ui.getContentRegion().x - buttonWidths, 0))
end
Expand Down

0 comments on commit 0b9a251

Please sign in to comment.