diff --git a/src/frontends/controllers/ControlViewSource.cpp b/src/frontends/controllers/ControlViewSource.cpp index c9bb578884..d3b9b6c33b 100644 --- a/src/frontends/controllers/ControlViewSource.cpp +++ b/src/frontends/controllers/ControlViewSource.cpp @@ -68,8 +68,10 @@ std::pair ControlViewSource::getRows() const int begrow = view->buffer()->texrow(). getRowFromIdPos(beg.paragraph().id(), beg.pos()); int endrow = view->buffer()->texrow(). + getRowFromIdPos(end.paragraph().id(), end.pos()); + int nextendrow = view->buffer()->texrow(). getRowFromIdPos(end.paragraph().id(), end.pos() + 1); - return std::make_pair(begrow, endrow); + return std::make_pair(begrow, endrow == nextendrow ? endrow : (nextendrow - 1)); }