Animal search gets cleared on Select Trainer
Steps:
- search for an animal type you got (ex: mountain goat)
- put the cursor on an animal
- press t to Select trainer
Issue: If your cursor was on the second mountain goat, the trainer gets assigned to the second animal in your complete creature list, instead of the second mountain goat you had selected. It seems to be because the search gets cleared once you press t This is not the case for other features of that screen, such as Slaughter, Geld, Toggle pet availability, etc
Before pressing t:

After pressing t:

Notice the cursor is now on a Stray water buffalo, not the mountain goat.
This seems to be because the "trainer selection" popup has its own dfhack search, and by default a screen can only have one search at a time
I can reproduce this.
The way we allow multiple search instances per screen is by passing an "ID" parameter to the generic_search_base template. And we are doing exactly that for all searches on the pets screen, with different ID parameters:
- https://github.com/DFHack/dfhack/blob/23e467deaf1dffaf5c82d13707c4af54a764f460/plugins/search.cpp#L892
- https://github.com/DFHack/dfhack/blob/23e467deaf1dffaf5c82d13707c4af54a764f460/plugins/search.cpp#L942
- https://github.com/DFHack/dfhack/blob/23e467deaf1dffaf5c82d13707c4af54a764f460/plugins/search.cpp#L1010
I'm not really sure what's going wrong here. You'll see the same issue with searching in the "Overall training" tab clearing the search in the "Creatures" tab, and I'm pretty sure that used to not be an issue.
maybe an unexpected interaction with 4e08357aaf3dc222f7d5dac4bf20e88f9b5d2d5d? that change could cause the reset of one search to reset other open searches, maybe?
I don't think that would explain it, because the same screen (viewscreen_petst) instance manages both tabs in question here (which is why the ID for the hooks is needed). There should be no way for breakdown_level to be nonzero and still have this screen displayed, since it's on the top of the stack.