Skip to content
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

Fix selected item name not being visible in some menus #78398

Merged
merged 2 commits into from
Dec 14, 2024

Conversation

moxian
Copy link
Contributor

@moxian moxian commented Dec 7, 2024

Summary

Bugfixes "Fix currently selected item not being visible in some menus"

Purpose of change

Fix this:
20241206-211630-cataclysm-tiles

Fixes #77368
Fixes #77503

Describe the solution

Cache entries' context less agressively - only when it is first read (i.e. when the menu is being rendered), and not immedaitely on construction (when it is still being prepared).
See

kmenu.addentry_desc( num, enabled, bind, ss, desc );
kmenu.entries[num].ctxt = ss_ctxt;
for an example of breaking code

Describe alternatives you've considered

Use getter/setter for setting .txt / .ctxt which would invalidate the cache at even more appropriate times. But that would mean working with getters/setters...

Testing

20241206-212036-cataclysm-tiles

20241206-220734-cataclysm-tiles

20241206-221143-cataclysm-tiles

Additional context

Originally broken by #76346 . Current PR does not reintroduce the problems #76346 was solving.

Astyle adds an extra indentation level to the whole of struct uilist_entry { now that I've marked the cached fields as private. I don't know if I should let them be public (to negate the diff) or if the indent is fine. Lemme know if i should change this.

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Dec 7, 2024
@moxian moxian marked this pull request as ready for review December 7, 2024 05:37
Copy link
Contributor

@db48x db48x left a comment

Choose a reason for hiding this comment

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

This looks great, but you should fix that warning about the duplicate public access specifier (structs are public by default).

@Night-Pryanik Night-Pryanik reopened this Dec 9, 2024
@Night-Pryanik Night-Pryanik reopened this Dec 14, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 14, 2024
@Night-Pryanik Night-Pryanik merged commit 3c1bf7d into CleverRaven:master Dec 14, 2024
55 of 75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
3 participants