Fix Show/Hide spell check clutter

This patch is needed until the future where we discard menus on close
This commit is contained in:
Liru Færs
2019-10-30 00:32:21 -04:00
parent 96b7612d73
commit 021ba21b4f

View File

@@ -3038,9 +3038,15 @@ void LLLineEditor::showContextMenu(S32 x, S32 y)
}
}
const std::string showstr("Show Misspellings"), hidestr("Hide Misspellings");
bool show = !glggHunSpell->getSpellCheckHighlight();
auto word = show ? "Show Misspellings" : "Hide Misspellings";
menu->addChild(new LLMenuItemCallGL(word, spell_show, nullptr, show ? &show : nullptr));
auto word = show ? showstr : hidestr;
if (!menu->hasChild(word))
{
menu->addChild(new LLMenuItemCallGL(word, spell_show, nullptr, show ? &show : nullptr));
if (auto child = menu->getChild<LLView>(show ? hidestr : showstr, false, false))
menu->removeChild(child);
}
}
mLastContextMenuX = x;