Fix off-by-one, adjust changelog, move scroll keys to consistent place

Ref #1748
develop
lethosor 2021-01-30 19:40:15 -05:00
parent 8967e98a33
commit 7e12f3fd3d
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 16 additions and 18 deletions

@ -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 - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles
## Misc Improvements ## 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 - `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`: 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 - `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 ## Documentation
- Added documentation for Lua's ``dfhack.run_command()`` and variants - 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 # 0.47.04-r4
## Fixes ## Fixes

@ -29,6 +29,20 @@ local function map_opttab(tab,idx)
end end
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 -- -- Widget --
------------ ------------
@ -344,13 +358,6 @@ end
Label = defclass(Label, Widget) Label = defclass(Label, Widget)
STANDARDSCROLL = {
STANDARDSCROLL_UP = -1,
STANDARDSCROLL_DOWN = 1,
STANDARDSCROLL_PAGEUP = '-page',
STANDARDSCROLL_PAGEDOWN = '+page',
}
Label.ATTRS{ Label.ATTRS{
text_pen = COLOR_WHITE, text_pen = COLOR_WHITE,
text_dpen = COLOR_DARKGREY, -- disabled text_dpen = COLOR_DARKGREY, -- disabled
@ -414,7 +421,7 @@ end
function Label:scroll(nlines) function Label:scroll(nlines)
local n = self.start_line_num + 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) n = math.max(n, 1)
self.start_line_num = n self.start_line_num = n
end end
@ -447,13 +454,6 @@ end
List = defclass(List, Widget) List = defclass(List, Widget)
SECONDSCROLL = {
SECONDSCROLL_UP = -1,
SECONDSCROLL_DOWN = 1,
SECONDSCROLL_PAGEUP = '-page',
SECONDSCROLL_PAGEDOWN = '+page',
}
List.ATTRS{ List.ATTRS{
text_pen = COLOR_CYAN, text_pen = COLOR_CYAN,
cursor_pen = COLOR_LIGHTCYAN, cursor_pen = COLOR_LIGHTCYAN,