* use new focus subsystem in widgets.EditField
* always eat the enter key if we have an on_submit
* add modal attribute
* give EditFields a default height of 1
so they can be autoarranged
* implement keyboard focus subsystem
* Fix error in focus group combining
* documentation for the inputToSubviews decision
* modify unit tests to catch that last bug
* fix wrong `Label.frame_body.x2` value
`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.
* add tests for Label
* add missing `local`, remove code in comments
* move `TestFramedScreen` outside test functions
* Added (chain) for [CHAIN_METAL_TEXT] armours in gui/materials.lua used by gui/create-item-- again (oops)
* Added customRawData utility
* Oops, whitespace
* Revised rawStringsFieldNames
* Dialed down on lua trickery and fixed wrongly formatted changelog entry
* Fixed changelog in wrong place and made customRawData a proper module
* Fixed not caching not-present tags, revised examples and fixed error
* Fixed whitespace. Changing settings in editor!
* customRawData docs
* Added getCreatureTag for respecting caste tags, "fixed" bizarre caching error (quotes because I don't even know what was causing it) and updated docs
* Added line limiting for docs, I guess
* Added missing string convert argument
* docs indent fix, code block fix, and revision
* Major revision
* gdi, docs error
* Another? But... huh.
* ...
* Made requested changes
* Whoops
* Rearrange docs lines
* Followed example, should fix linter issues
* fix typo. linted offline this time......
* Make it so that last instance of tag is what is read from
* Added requested change
* eventful key change
* i to lenArgs
* change eventful key
* add test for broken caste selection
* Major redesign
* tags --> tokens
* Added plant growth behaviour and did some requested changes
* More error handling
* fix docs
* Added basic error suppression
* Docs clarification.
* Docs registering example and fix error
* Strip errors on frame after onWorldLoad, not on map load
* Revert "Strip errors on frame after onWorldLoad, not on map load"
This reverts commit e20a0ef8d3743f79d961077f46910b77b16f36b9.
* Revert "Docs registering example and fix error"
This reverts commit 9c848c54c3f84e0ecc1dc421137c8a8b4a52280d.
* Revert "Docs clarification."
This reverts commit 6b4b6a1aa40c50398504f37ecf1ff0f93d6459b1.
* Revert "Added basic error suppression"
This reverts commit d11cb1438cf1e56ff700469e944f0b9af64651d7.
* Use more eventful key more consistent with other files
* use onStateChange instead of eventful and remove redundant utils require
* Code review stuff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs/Lua API.rst
committing a suggestion
Co-authored-by: Alan <lethosor@users.noreply.github.com>
* Prepend examples with DFHACK_
* Remove unused parameters
* Use new ensure_key global
* Named a couple of unnamed arguments (untested)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
* WIP: add scroll icons to Label widget
It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction.
WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it
* gui.lua: expose the `parse_inset()` function
* refactor Label's scroll icon code
* since `render_scroll_icons` only works with a label, it's now a class function
* `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons`
* `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`.
* make `render_scroll_icons` always draw icons
The check now happens in `onRenderFrame`
* draw frame's background
calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason
* remove trailing spaces
* fix scroll icons placed far above/below text
With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above,
but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame
instead of near the first and last rendered text line.
* always `update_scroll_inset` to react to resized window
* draw scroll icons next to text
* update `Lua API.rst` with new `Label` parameters
* move comment separator up
This way every scroll related parameter is in one group
* list default values for new parameters in docs
* add missing description of `Label.scroll_keys`
settled on `find()` since the string method of the same name has the
same semantics. other options: `str_find()` since it fails on non-string
or `match()` (but that might imply that the pattern needs to match the
entire string).
`dismiss_on_submit = false` makes it easier to implement toggleable options, where we don't want the list to disappear on selection. Like work order conditions' trait selection.
added string:split
added string:trim
added a default value for wrap width
added function comments
added tests for all string functions (the tests for string:split will be commented out until we remove the competing implementation in gui/load-screen
Current logic is because @myk002 fixed it so label would allow other widgets control when label(s) are present. However that breaks label key detection for default scroll keys. This can be worked around by setting scrollkeys to empty.
TBH: label is quite complicated and used everwhere so i'm reluctant to touch it and would love for someone to look over if i'm correct.
- provides expect,printerr_match for matching printerr output
- fails tests if printerr is called outside the printerr_match wrapper
- changes api of expect.error_match to mirror the new printerr_match api
This allows tests to test these functions without needing to include the test
wrapper directly (now ci/test.lua, formerly test/main.lua). Hopefully this
location is also more stable, similar to other libraries that are already tested.
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.
this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
Objects with links like `job` output way too much. With this change, it's possible to provide an optional filter and exclude the `list_link`.
```
[lua]# j = dfhack.gui.getSelectedJob()
[lua]# printall_recurse(j, {[tostring(j.list_link)]=true, [tostring(j.pos)]=true})
```
I often want to see multiple items quickly when trying to figure out
what states actually matter to an issue that I debug. I decided to make
it easier to quickly dump df structures with substructures and
containers. It will generate large amount of data which can be sometimes
slow to process manually. But processing can be automated using
dfhack-run lua ^<df data to inspect> and pipe to other tools (eg grep,
sed, perl, sort, uniq etc)
Console::lineedit can return -1 to indicate input error and -2 to
indicate the program is closing. But most users don't check possible
unusual return values which can lead to exit hang.
Changes include
* table.getn(obj) -> #obj
* Making sure string.rep gets an integer parameter
* Optimized profiling hooks (call profiler cost from factor 40 to 10)
* Specialized parameter name lookup code for c++ __index metamod calls
* Collect source lines in time sampling variant
* Simplified prevent to always filter all children
Pepperfish Profiler can produce time sampled profiles and call entry
exit profiles. Code is verbatim copy from the lua wiki [1]. This commit
won't work alone but it exists to give author credit correctly to
Daniel.
[1] http://lua-users.org/wiki/PepperfishProfiler
Authors:
Daniel Silverstone <dsilvers@pepperfish.net>
Tom Spilman <tom@sickheadgames.com>
Ben Wilhelm <zorba-pepperfish@pavlovian.net>
The presence of syndrome data in unit.syndromes.active generates corresponding wound data in unit.body.wounds. This wound data acts to produce all of the syndrome's actual effects, including but not limited to flag changes, interaction abilities, body transformation and display name alterations. Wound data persists when syndrome data is cleared from unit.syndromes.active. Since syndrome-util did not touch wound data at all, the erase function was completely ineffective at actually removing syndromes.
Note that syndromes also generate a bunch of data in the historical figure information of units. I have observed that this historical data is sufficient to restore the syndrome in a unit following map reload (at least in adventure mode), so its clearance (which needs to also include any corresponding interaction effects) will have to be addressed in a future update. As is, syndrome erasure remains incomplete.
There is a lot more errors in this file, mostly called unk variables... I bet they have names, I've tried to figure out what they were renamed too, but I'm not fully understanding the xml.