Skip to content

stocks: add expand_all to stocks interface - #5809

Merged
ab9rf merged 6 commits into
DFHack:developfrom
emreduzenli:expand-all-stocks
Aug 30, 2026
Merged

stocks: add expand_all to stocks interface#5809
ab9rf merged 6 commits into
DFHack:developfrom
emreduzenli:expand-all-stocks

Conversation

@emreduzenli

Copy link
Copy Markdown
Contributor

Fixes #5338

Comment thread plugins/lua/stocks.lua Outdated
for idx=0,num_sections-1 do
stocks.current_type_a_expanded[idx] = true
end
stocks.i_height = num_sections * 3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm uncertain that this is the correct thing to do here, but I also don't understand why collapse_all does the same thing. So if someone could explain this to me, it would help me feel better about approving this change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you were right to be suspicious. stocks.i_height appears to be the total height of the right hand side (in interface lines, 3 per entry). When expanding all entries, the total height of the right inside could be computed as simply as:

Suggested change
stocks.i_height = num_sections * 3
num_items = #stocks.current_type_i_list
stocks.i_height = (num_items + num_sections) * 3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the clarification, I've updated the branch to reflect your suggested way of computing it

@ab9rf
ab9rf merged commit faac8f3 into DFHack:develop Aug 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stocks screen option to "expand all" categories

3 participants