diff --git a/docs/changelog.txt b/docs/changelog.txt index 0fa9872c2..aee5aa850 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles ## Misc Improvements +- Lua label widgets (used in all standard message boxes) are now scrollable with Up/Down/PgUp/PgDn keys - `autofarm`: now fallows farms if all plants have reached the desired count - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` - `buildingplan`: add 'enable all' option for buildingplan (so you don't have to enable all building types individually). this setting is not persisted (just like quickfort_mode is not persisted), but it can be set from onMapLoad.init @@ -55,9 +56,6 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Documentation - Added documentation for Lua's ``dfhack.run_command()`` and variants -## Misc Improvements -- Lua widget library Label class (used in all standard message boxes) is now scrollable with Up/Down/PgUp/PgDn keys - # 0.47.04-r4 ## Fixes diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 29d5aa827..d3e32b910 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -29,6 +29,20 @@ local function map_opttab(tab,idx) end end +STANDARDSCROLL = { + STANDARDSCROLL_UP = -1, + STANDARDSCROLL_DOWN = 1, + STANDARDSCROLL_PAGEUP = '-page', + STANDARDSCROLL_PAGEDOWN = '+page', +} + +SECONDSCROLL = { + SECONDSCROLL_UP = -1, + SECONDSCROLL_DOWN = 1, + SECONDSCROLL_PAGEUP = '-page', + SECONDSCROLL_PAGEDOWN = '+page', +} + ------------ -- Widget -- ------------ @@ -344,13 +358,6 @@ end Label = defclass(Label, Widget) -STANDARDSCROLL = { - STANDARDSCROLL_UP = -1, - STANDARDSCROLL_DOWN = 1, - STANDARDSCROLL_PAGEUP = '-page', - STANDARDSCROLL_PAGEDOWN = '+page', -} - Label.ATTRS{ text_pen = COLOR_WHITE, text_dpen = COLOR_DARKGREY, -- disabled @@ -414,7 +421,7 @@ end function Label:scroll(nlines) local n = self.start_line_num + nlines - n = math.min(n, self:getTextHeight() - self.frame_body.height) + n = math.min(n, self:getTextHeight() - self.frame_body.height + 1) n = math.max(n, 1) self.start_line_num = n end @@ -447,13 +454,6 @@ end List = defclass(List, Widget) -SECONDSCROLL = { - SECONDSCROLL_UP = -1, - SECONDSCROLL_DOWN = 1, - SECONDSCROLL_PAGEUP = '-page', - SECONDSCROLL_PAGEDOWN = '+page', -} - List.ATTRS{ text_pen = COLOR_CYAN, cursor_pen = COLOR_LIGHTCYAN,