X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FRow.cpp;h=16ae9aecb6e0f988535493cd8f5841f2ef2e039a;hb=5366666c831b6ad726e848a60d738b57ec8b0501;hp=483094ac3b5a130f3af7a27cd0b6baef06913942;hpb=51b37cd4d87200afcd5b51445a263070f72947b4;p=lyx.git diff --git a/src/Row.cpp b/src/Row.cpp index 483094ac3b..16ae9aecb6 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -626,15 +626,17 @@ Row::findElement(pos_type const pos, bool const boundary, double & x) const const_iterator cit = begin(); for ( ; cit != end() ; ++cit) { - /** Look whether the cursor is inside the element's - * span. Note that it is necessary to take the - * boundary into account, and to accept virtual - * elements, which have pos == endpos. + /** Look whether the cursor is inside the element's span. Note + * that it is necessary to take the boundary into account, and + * to accept virtual elements, in which case the position + * will be before the virtual element. */ - if (pos + boundary_corr >= cit->pos - && (pos + boundary_corr < cit->endpos || cit->isVirtual())) { - x += cit->pos2x(pos); - break; + if (cit->isVirtual() && pos + boundary_corr == cit->pos) + break; + else if (pos + boundary_corr >= cit->pos + && pos + boundary_corr < cit->endpos) { + x += cit->pos2x(pos); + break; } x += cit->full_width(); }