keep focus strings if they are already labeled

i.e. don't add a "dfhack/" prefix if the focus string already has the
string "dfhack" in it
develop
Myk Taylor 2023-02-19 23:27:16 -08:00
parent 816371ca69
commit d7d3dcb0be
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 7 additions and 2 deletions

@ -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;
}