Fix word-boundary checking for edit box spellchecking

This commit is contained in:
Thomas Goyne 2012-12-21 16:29:59 -08:00
parent 835f7c0f78
commit 24aef1ffef

View file

@ -479,7 +479,7 @@ void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) {
std::pair<int, int> SubsTextEditCtrl::GetBoundsOfWordAtPosition(int pos) { std::pair<int, int> SubsTextEditCtrl::GetBoundsOfWordAtPosition(int pos) {
int len = 0; int len = 0;
for (auto const& tok : tokenized_line) { for (auto const& tok : tokenized_line) {
if ((int)tok.length > pos) { if (len + (int)tok.length > pos) {
if (tok.type == agi::ass::DialogueTokenType::WORD) if (tok.type == agi::ass::DialogueTokenType::WORD)
return std::make_pair(len, tok.length); return std::make_pair(len, tok.length);
return std::make_pair(0, 0); return std::make_pair(0, 0);