-
Notifications
You must be signed in to change notification settings - Fork 493
orders: add search overlay for manager orders #5677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Adds search overlay to find and navigate manager orders with arrow indicators showing current search result. Search uses Alt+S to focus, Alt+P/N for prev/next navigation. Overlays are disabled by default.
ChrisJohnsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice workaround for the inability to filter the view like in the other info panel search widgets.
I like the labeled magic numbers in OrderHighlightOverlay. DF's layout behavior is not fun thing to have to replicate, but I think this would be fairly clear to someone that hasn't looked at this stuff as much (at least as long as they have DF at hand to try out different window sizes).
Re: not being able to detect exiting the window: yeah, I have also wanted something
like a callback for "this overlay is no longer active (not going to be rendered)".
- Would utils.search_text be useful here? The main SortOverlay uses it for searching.
- Could the first match automatically be highlighted on Enter?
I can see how you might not want to highlight (thus likely move the scroll position) for each change in search input, but Enter seems like a nice place to jump to the first match. - The highlight should probably be cleared when the search text changes (especially when the highlighted order does not match the new search input).
- It might just be my color vision being flaky, but I completely did not notice the highlight arrow at first. Now that I know what to look for, it isn't hard to spot. But my first cycling through the matches was confusing because it wasn't obvious which order was being indicated.
Now there is 16 visible chars in search
I switched to using utils.search_text instead of the custom search logic
Added Enter/Shift+Enter to cycle through matches using the default submit/submit2 methods.
Fixed, now the highlight gets cleared whenever the search text changes.
I reshaped the arrow, moved it to the right side of icon and used more contrasting colors (black on white) to make it more visible. @ChrisJohnsen Thanks for all the detailed feedback! I made each change in a separate commit to make the review easier. Let me know if there's anything else that needs adjusting. |
ChrisJohnsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spotting of the need to hide when job_details.open. The other functionality changes all seem good (with a new note about order deletion handling).
I've put some more thoughts on the specifics of the code in this review.
|
So, I hadn't looked into the details of But those The other caller is |
… results after sorting/clearing/importing orders
…r missing entries
…le-locals and inline arrow colors
Thanks for the suggestion, I used workshop button trick to make this works. Looks good and fast 👍 |
|
Interesting. I see that the similar Despite the similarity with For fun I also benched a Lua-only implementation. It is slower but not so slow that I noticed any problems in interactive use (55µs per query in a bench of a quarter million; ~35µs after some tweaking). So it could conceivably live on the Lua side if there isn't a good place for it on the C++ side. I noticed the addition of setting This last niggle also exists in There are a couple of small UI bugs:
|
ChrisJohnsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a review to tick the requested-review box. My previous comment also mentions a couple of remaining UI bugs.
|
Found a leftover while reviewing my local notes: If |
Sorry, but I don't understand what this is about.
UI bugs fixed and some more changes:
I love how it feels to use now that the order highlights stay visible. It's much more user-friendly. Thanks @ChrisJohnsen for the review!
|
Yeah, that was just GitHub noise. My first comment ("Interesting. …") was just a "comment" (not a "review"), so it did not clear the "review requested" state. I posted the second one ("Here is a review…") as a actual "review" to have GitHub mark the PR as "reviewed". |
|
Since all matches are now being highlighted You might want to use time-based updating instead of frame-based so that the update time doesn't vary (as much) with configured (or effective) frame rate. The overlay system provides periodic calls to the Hmm, this is another case where a "post input" callback would be handy. I've come across other uses for an overlay callback that occurs after DF has handled an input. Pretty much all player-originated order changes will need to done through some kind of input, so this overlay could (if a "post input" callback was available) just check whether the orders have changed after each input instead of periodically... I've added this use case to my notes. Since the inter-overlay coordination has been awkward a couple of times (and just changed to be bi-directional with The variable-mediated coordination relies to the pseudo-singleton nature of overlays (as managed by the overlay system) which isn't documented at all as far as I have seen. Drawing the highlights outside the main widget's frame is kind of non-standard behavior and relies on the painter being clipped to the full interface area. The Neither is a perfect, but combining the overlays would get rid of all the non-constant variables. A minor thing about "checksum": To me, the "checksum" strongly implies a small (or constant-sized) value. The concatenation of order names is serving a similar purpose (change detection), but it is basically just a copy of the data it is checking. Something like I experimented with a "checksum"-free version that just periodically, unconditionally called a modified |
Fixed
Great idea, done with 1 second period
Done. Tried to do full_interface=true, but it makes no way to drag window using widget position adjustment ui, so it works without it
Renamed to concat_order_names() and cached_order_names I made another UX improvement: scroll to selected order only when needed. Video in PR updated |


Add search to manager orders
Adds search box to find orders by job name + arrow indicators to show which one you're looking at.
What it does
Implementation
OrdersSearchOverlayenabled by defaultimportexportoverlay position to make room for search (and make new version of config)What didn't work
Related issues
Dwarf.Fortress.2026-01-04.14-44-09.mp4