Merge pull request #2952 from myk002/myk_keep_focus

[Gui] don't prefix focus strings that are already properly marked
develop
Myk 2023-02-26 09:23:42 -08:00 committed by GitHub
commit e81a45a742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Documentation
## API
- Gui focus strings will no longer get the "dfhack/" prefix if the string "dfhack/" already exists in the focus string
## Lua
-@ ``gui.INTERIOR_FRAME``: a panel frame style for use in highlighting off interior areas of a UI

@ -491,7 +491,12 @@ bool Gui::matchFocusString(std::string focus_string, df::viewscreen *top) {
static void push_dfhack_focus_string(dfhack_viewscreen *vs, std::vector<std::string> &focusStrings)
{
auto name = vs->getFocusString();
focusStrings.push_back(name.empty() ? "dfhack" : "dfhack/" + name);
if (name.empty())
name = "dfhack";
else if (string::npos == name.find("dfhack/"))
name = "dfhack/" + name;
focusStrings.push_back(name);
}
std::vector<std::string> Gui::getFocusStrings(df::viewscreen* top)

@ -877,7 +877,7 @@ void dfhack_lua_viewscreen::update_focus(lua_State *L, int idx)
if (focus.empty())
focus = "lua";
else
else if (string::npos == focus.find("lua/"))
focus = "lua/"+focus;
}