Fix by-word/paragraph text selection in WebPage.

This commit is contained in:
John Preston 2019-12-03 11:08:55 +03:00
parent 12f5ccaaa5
commit 8535a579ca

View File

@ -678,12 +678,12 @@ TextSelection WebPage::adjustSelection(TextSelection selection, TextSelectType t
return _siteName.adjustSelection(selection, type);
}
auto titlesLength = _siteName.length() + _title.length();
auto titleSelection = _title.adjustSelection(toTitleSelection(selection), type);
if ((!_siteNameLines && !_descriptionLines) || (selection.from >= _siteName.length() && selection.to <= _description.length())) {
if ((!_siteNameLines && !_descriptionLines) || (selection.from >= _siteName.length() && selection.to <= titlesLength)) {
return fromTitleSelection(titleSelection);
}
auto titlesLength = _siteName.length() + _title.length();
auto descriptionSelection = _description.adjustSelection(toDescriptionSelection(selection), type);
if ((!_siteNameLines && !_titleLines) || selection.from >= titlesLength) {
return fromDescriptionSelection(descriptionSelection);