myk002
fc556c9e5d
implement non-alias long form params
...
now long form parameters can exist by themselves without being an alias
for a required equivalent short form param
2021-09-25 22:00:49 -07:00
lethosor
d5be63823d
Merge remote-tracking branch 'TymurGubayev/patch-1' into develop
2021-08-31 00:55:36 -04:00
myk002
691e54dfc6
rename expect.find to expect.str_find
2021-08-24 21:06:12 -07:00
myk002
b2f44f00f1
add pattern matching expect.find() for unit tests
...
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).
2021-08-23 22:59:30 -07:00
lethosor
10db894d99
Merge remote-tracking branch 'myk002/myk_printall_nontable' into develop
2021-08-21 22:51:35 -04:00
lethosor
d4e40b260e
Merge remote-tracking branches 'TymurGubayev/patch-2' and 'TymurGubayev/patch-3' into develop
2021-08-21 11:30:36 -04:00
Timur Kelman
ca8d89df5a
alt_getopt.lua: allow `?` as an option
...
This makes it possible to call `script -?`
2021-08-21 13:39:10 +02:00
Timur Kelman
bd423ca47c
argparse.lua: `hasArgument` in a comment refers to `hasArg` everywhere else
2021-08-21 13:27:09 +02:00
myk002
86b2329b7f
fix hardcoded call to pairs, add test
2021-08-20 22:55:07 -07:00
myk002
d9c6c2dde3
add safe_pairs, update unit tests
2021-08-19 21:57:16 -07:00
myk002
6d0f7e40a9
be silent if iteration fails for printall
2021-08-19 21:57:16 -07:00
myk002
3f2795e80a
unit tests first draft
2021-08-19 21:56:44 -07:00
myk002
9fc71ef6e1
printall and printall_ipairs handle all iterables
2021-08-19 21:56:43 -07:00
myk002
4606d5742e
ensure printall, ~, and @ behave in lua 5.3.6
2021-08-19 21:56:41 -07:00
lethosor
e8d9a9d184
Fix out-of-bounds access in memscan.field_offset()
...
Fixes #1907
2021-08-10 11:26:06 -04:00
Timur Kelman
15d8a0bea2
rename `dismiss_on_submit|2` to `dismiss_on_select|2`
...
to avoid confusion
2021-07-30 17:25:01 +02:00
Timur Kelman
ffecdf3b53
ListBox attributes controlling self:dismiss()
...
`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.
2021-07-29 19:00:19 +02:00
lethosor
898d4621da
Merge remote-tracking branch 'myk002/myk_view_unit' into develop
2021-07-05 20:42:49 -04:00
myk002
87c7d02e09
support view unit mode for guidm.enterSidebarMode
2021-07-05 16:02:19 -07:00
myk002
17d4be14f3
fix formatting of coords error message
2021-07-05 16:01:07 -07:00
myk002
f62ff3ecc0
migrate existing lua code to use new library fns
2021-07-05 15:48:51 -07:00
lethosor
2f36404da7
Merge remote-tracking branch 'origin/lua_label_input_fix' into develop
2021-07-05 15:42:06 -04:00
lethosor
3e6cecbbc6
Merge remote-tracking branch 'myk002/myk_argparse' into develop
2021-07-05 15:21:59 -04:00
lethosor
fb7560d8bf
Merge remote-tracking branch 'wolfboyft/patch-2' into develop
2021-07-05 11:41:37 -04:00
myk002
0ef5134a33
add optional coordinate validation to coords
2021-07-04 07:32:29 -07:00
myk002
56a1c8b4d5
coordinates can be 0
2021-07-03 16:26:39 -07:00
myk002
3a8f564cd2
forward old processArgs fns to new locations
2021-07-02 23:21:40 -07:00
myk002
9535ff82bb
add argparse library functions
2021-07-02 23:11:17 -07:00
myk002
36b2d05ff6
add dfhack string functions and tests
...
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
2021-07-02 13:21:54 -07:00
myk002
eafa6e86f7
add utils.normalizePath()
2021-06-29 12:22:05 -07:00
lethosor
e070f4d9d8
Merge remote-tracking branch 'myk002/myk_sidebar' into develop
2021-06-28 01:03:13 -04:00
lethosor
4945018e92
Merge remote-tracking branch 'myk002/myk_multi_mock' into develop
2021-06-25 01:27:46 -04:00
lethosor
1b167e7898
Also add quotes in expect.ne()
...
Extension of #1886
2021-06-24 01:15:15 -04:00
lethosor
72998cddd5
Merge remote-tracking branch 'myk002/myk_expect_quotes' into develop
2021-06-24 01:11:21 -04:00
myk002
67840c033c
add quotes around printed unequal values
...
so you can see confusing hidden trailing spaces
2021-06-23 14:04:16 -07:00
myk002
5b12c64cba
add new string function: wrap()
...
refactored and improved from the implementation in quickfort's dialog.lua
2021-06-23 13:59:39 -07:00
myk002
000b589e3a
add dwarfmode library function: enterSidebarMode()
...
refactored from quickfort. this common implementation will replace the
now redundant functions in quickfort, gui/mass-remove, and gui/blueprint
2021-06-23 12:29:37 -07:00
Warmist
b7069a5ebd
Fix label early key detection in scrolling logic
...
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.
2021-06-22 11:31:00 +03:00
Tachytaenius
990c153a9a
Show adjective in item prompt
...
Useful for high boot/low boot etc.
2021-06-19 13:59:38 +01:00
myk002
b7a970a309
allow mock.func() to return multiple values
2021-06-15 13:16:05 -07:00
myk002
59b08e99f6
fix -- handling and required arg detection
2021-05-07 15:21:45 -07:00
myk002
fd735d4b42
treat negative numbers as non-options in getopt
2021-05-07 15:21:45 -07:00
lethosor
ee8e10429d
Add initial implementation of mock.restore()
...
Like mock.patch() but only restores original values instead of also setting
new values initially.
2021-04-16 00:34:46 -04:00
lethosor
757736728d
Add a mock.func() helper for mocking functions
2021-04-10 01:22:03 -04:00
lethosor
5424392273
mock.patch(): propagate return values
2021-04-09 00:41:39 -04:00
lethosor
f25b8a0d14
Fix patching value with nil
2021-04-09 00:35:54 -04:00
lethosor
7b2f01d45b
Add initial mock.patch() implementation for tests
2021-04-09 00:32:10 -04:00
myk002
642d8cbe4b
handle nil values sent to printerr
2021-04-05 01:37:43 -07:00
myk002
13ca7f8c9e
move expect.lua from internal/ to test_util/
2021-04-04 17:37:37 -07:00
myk002
5af1b627cb
add tests, move expect.lua
...
I moved expect.lua from library/lua/test/ to library/lua/internal since
luacov is configured to ignore any file with /test/ in its path
2021-04-04 17:37:36 -07:00
myk002
a6561911c1
error on unmatched printerr output during a test
...
- 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
2021-04-04 17:37:33 -07:00
myk002
4e844f39ae
undo formatting change in script_environment
2021-03-29 12:29:15 -07:00
myk002
54a1e8d98a
move script_environment changes to test.lua
2021-03-29 12:23:53 -07:00
myk002
e4cab1b1c6
load scripts into different namespace for testing
2021-03-29 11:26:28 -07:00
lethosor
2332009825
Merge remote-tracking branch 'myk002/myk_enable_luacov' into develop
2021-03-28 00:38:36 -04:00
lethosor
5e09fd882d
Fix Painter:viewport()
...
This works because Painter inherits from ViewRect. Unsure how this went unnoticed.
2021-03-27 16:55:48 -04:00
lethosor
62776f5568
Move `expect` functions to a separate file
...
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.
2021-03-24 00:48:52 -04:00
myk002
754baa45b3
remove io overrides
...
they were causing side effects when writing luacov reports
2021-03-07 08:16:24 -08:00
myk002
ba6a02eb59
call luacov.runner.init directly and clean up dbg
2021-03-07 08:16:24 -08:00
myk002
418a8c5d21
propagate luacov debug hook through coroutines
2021-03-07 08:16:24 -08:00
lethosor
7e12f3fd3d
Fix off-by-one, adjust changelog, move scroll keys to consistent place
...
Ref #1748
2021-01-30 19:40:15 -05:00
lethosor
8967e98a33
Merge remote-tracking branch 'myk002/myk_scrollable_labels' into develop
2021-01-30 19:33:04 -05:00
lethosor
4126585573
Merge remote-tracking branch 'lethosor/lua-runcommand' into develop
2021-01-29 20:27:38 -05:00
lethosor
de6f9183fd
Fix changelog, replace a couple qerror calls with error
...
Ref #1746
2021-01-29 00:04:10 -05:00
myk002
5a2181d55e
don't render overflow text
2021-01-13 22:02:22 -08:00
myk002
39d274b00e
address review comments
2021-01-12 23:42:53 -08:00
myk002
d4fbf4261f
address review comments
2021-01-12 23:27:14 -08:00
myk002
dac9538fd9
let navigation keys propagate
...
so other components can use them for simultaneous control
2021-01-11 15:02:12 -08:00
Myk Taylor
2797061b04
scroll Label text when height exceeds viewrect
2021-01-11 14:47:05 -08:00
Myk Taylor
175776812e
implement a nice API wrapper for getopt
2021-01-10 16:51:46 -08:00
Myk Taylor
3b45878d41
allow non-options in commandlines and return them
...
also call qerror() on error, not os.exit
2021-01-10 16:51:45 -08:00
Myk Taylor
20276be50f
check in unaltered version of alt_getopt
2021-01-10 16:51:45 -08:00
lethosor
614ea739d0
Merge branch 'develop' into lua-runcommand
2021-01-08 20:45:23 -05:00
myk002
3ba984c22c
only reset extents if they are unusable
...
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.
2020-12-16 11:10:47 -08:00
lethosor
a9bb11c145
Optimize Lua's internal.runCommand() when printing directly to the console
...
This also makes commands run with `run_command()` detect the console properly (notably used by `df2console()`)
2020-11-20 17:57:54 -05:00
lethosor
fb44b26b47
Make utils.addressof() work for raw userdata
2020-11-19 21:32:42 -05:00
Myk Taylor
186f28a94b
filters for altars, display cases, and bookcases
2020-10-23 09:11:07 -07:00
Myk Taylor
3c51bb51ab
remove references to non-existent vector ids
2020-09-28 23:14:13 -07:00
Myk Taylor
6cc1428199
Merge remote-tracking branch 'upstream/develop' into buildings_vectors
2020-09-28 23:13:13 -07:00
lethosor
dfac5bc143
Update gui.Painter docs, add sections to dfhack.screen, add more links, etc
2020-09-23 22:00:39 -04:00
Myk Taylor
f837532b42
use more precise item vectors for bld item filters
2020-09-13 17:12:29 -07:00
lethosor
3b5a82cc05
Change color of ListBox.select2_hint to grey to indicate enabled
...
Ref dfhack/scripts#185
2020-08-27 00:08:28 -04:00
lethosor
c034276af5
Merge remote-tracking branch 'myk002/quickfort_filter' into develop
2020-08-21 00:34:34 -04:00
Myk Taylor
9a3e9d5b12
listbox filter can match strings after punctuation
2020-08-17 21:15:33 -07:00
Myk Taylor
8a438c2a55
allow row_height to be set from the ListBox class
2020-08-17 21:14:05 -07:00
nicolasayala
141928ead0
Fix gui.FilteredList widget search on plain string choices
2020-02-27 07:56:30 +01:00
Timur Kelman
1d8998de22
allow custom filter in `dfhack.printall_recurse`
...
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})
```
2020-02-23 16:57:57 +01:00
Ben Lubar
96d8dffd32
Make dfhack.run_command return the command_result value.
...
Rename local variables to match dfhack.run_command_silent for clarity.
2020-01-14 17:53:52 -06:00
lethosor
49563b4618
Merge remote-tracking branch 'warmist/FilteredListFix' into develop
2019-11-02 16:28:06 -04:00
Warmist
a2b5c1ddd9
lua/widgets filtered list input fix
...
FilteredList was not consuming input events.
2019-09-30 22:00:06 +03:00
lethosor
e5eade1ad7
Make gui.dwarfmode.{get_movement_delta,get_hotkey_target} public
2019-04-30 16:53:09 -04:00
lethosor
163c9b4059
Add utils.OrderedTable, make test order consistent
...
Also added OrderedTable tests and comment support to expect.*()
2018-07-19 12:40:25 -04:00
lethosor
c006df561e
Merge remote-tracking branch 'suokko/lua_printall_recurse' into develop
2018-07-06 14:25:35 -04:00
lethosor
c449041c11
Merge remote-tracking branch 'suokko/lua_List_setChoices_internal_table_1171' into develop
2018-07-03 00:27:22 -04:00
Pauli
ba1d3fcb6a
Add dfhack.printall_recurse to quickly print df containers
...
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)
2018-06-30 22:31:49 +03:00
Pauli
1fc37f8ddc
Checke Console::lineedit error return values
...
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.
2018-06-22 17:57:37 +03:00
Pauli
98b25e3462
Allow calling List:setChoices() to clear choices
2018-06-20 17:46:24 +03:00
Pauli
ed23d2c4e2
Change gui.widgets.List:setChoices to keep state in internal table
...
Fixes #1171
2018-06-20 17:23:57 +03:00
lethosor
fe458d3ac1
Merge remote-tracking branch 'grubsteak/patch-2' into develop
2018-06-08 22:05:20 -04:00
Pauli
e3df5cd765
Port profiler to lua 5.3 and dfhack
...
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
2018-06-06 19:18:18 +03:00