Select the last token when double-clicking past the end of the text in the edit box

This commit is contained in:
Thomas Goyne 2014-06-20 10:44:14 -07:00
parent 790d52b113
commit 961e6dab88

View file

@ -373,12 +373,19 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
}
void SubsTextEditCtrl::OnDoubleClick(wxStyledTextEvent &evt) {
int pos = evt.GetPosition();
if (pos == -1 && !tokenized_line.empty()) {
auto tok = tokenized_line.back();
SetSelection(line_text.size() - tok.length, line_text.size());
}
else {
auto bounds = GetBoundsOfWordAtPosition(evt.GetPosition());
if (bounds.second != 0)
SetSelection(bounds.first, bounds.first + bounds.second);
else
evt.Skip();
}
}
void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) {
if (currentWord.empty()) return;