Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Template for new versions:
- `orders`: prevent import/export overlay from appearing on the create workorder screen
- `caravan`: corrected prices for cages that have units inside of them
- `tailor`: remove crash caused by clothing items with an invalid ``maker_race``
- ``dialogs.MessageBox``: fix spacing around scrollable text
- `seedwatch`: seedwatch will now ignore (unplantable) tree seeds entirely
- `autobutcher`: fix ``ticks`` commandline option incorrectly rejecting positive integers as valid values

Expand Down
15 changes: 8 additions & 7 deletions library/lua/gui/dialogs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MessageBox.focus_path = 'MessageBox'

MessageBox.ATTRS{
frame_style = gui.WINDOW_FRAME,
frame_inset = 1,
frame_inset = {l=1, t=1, b=1, r=0},
-- new attrs
on_accept = DEFAULT_NIL,
on_cancel = DEFAULT_NIL,
Expand All @@ -33,13 +33,14 @@ end
function MessageBox:getWantedFrameSize()
local label = self.subviews.label
local width = math.max(self.frame_width or 0, 20, #(self.frame_title or '') + 4)
local text_area_width = label:getTextWidth()
if label.frame_inset then
-- account for scroll icons
text_area_width = text_area_width + (label.frame_inset.l or 0)
text_area_width = text_area_width + (label.frame_inset.r or 0)
local text_area_width = label:getTextWidth() + 1
local text_height = label:getTextHeight()
local sw, sh = dfhack.screen.getWindowSize()
if text_height > sh - 4 then
-- account for scrollbar
text_area_width = text_area_width + 2
end
return math.max(width, text_area_width), label:getTextHeight()
return math.max(width, text_area_width), text_height
end

function MessageBox:onRenderFrame(dc,rect)
Expand Down