diff --git a/src/BufferView.cpp b/src/BufferView.cpp index d871095481..097a465f7b 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2970,7 +2970,7 @@ void BufferView::setCurrentRowSlice(CursorSlice const & rowSlice) } -void BufferView::checkCursorScrollOffset(PainterInfo & pi) +void BufferView::checkCursorScrollOffset() { CursorSlice rowSlice = d->cursor_.bottom(); TextMetrics const & tm = textMetrics(rowSlice.text()); @@ -2981,8 +2981,7 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi) return; ParagraphMetrics const & pm = tm.parMetrics(rowSlice.pit()); Row const & row = pm.getRow(rowSlice.pos(), - d->cursor_.boundary() - && rowSlice == d->cursor_.top()); + d->cursor_.boundary() && rowSlice == d->cursor_.top()); rowSlice.pos() = row.pos(); // Set the row on which the cursor lives. @@ -2993,7 +2992,8 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi) // Horizontal scroll offset of the cursor row in pixels int offset = d->horiz_scroll_offset_; - int const MARGIN = Length(2, Length::EM).inPixels(pi.base); + int const MARGIN = 2 * theFontMetrics(d->cursor_.real_current_font).em(); + //lyxerr << "cur_x=" << cur_x << ", offset=" << offset << ", margin=" << MARGIN << endl; if (cur_x < offset + MARGIN) { // scroll right offset = cur_x - MARGIN; @@ -3034,7 +3034,7 @@ void BufferView::draw(frontend::Painter & pain) // Check whether the row where the cursor lives needs to be scrolled. // Update the drawing strategy if needed. - checkCursorScrollOffset(pi); + checkCursorScrollOffset(); switch (d->update_strategy_) { diff --git a/src/BufferView.h b/src/BufferView.h index 91167100ce..bfdb0bac42 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -349,7 +349,7 @@ private: // Check whether the row where the cursor lives needs to be scrolled. // Update the drawing strategy if needed. - void checkCursorScrollOffset(PainterInfo & pi); + void checkCursorScrollOffset(); /// The minimal size of the document that is visible. Used /// when it is allowed to scroll below the document. diff --git a/src/Text3.cpp b/src/Text3.cpp index 0e51bb0865..8efec47202 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1614,7 +1614,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case mouse_button::button1: // Set the cursor if (!bv->mouseSetCursor(cur, cmd.argument() == "region-select")) - cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor); + cur.screenUpdateFlags(Update::FitCursor); if (bvcur.wordSelection()) selectWord(bvcur, WHOLE_WORD); break; @@ -1639,7 +1639,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) return; } if (!bv->mouseSetCursor(cur, false)) - cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor); + cur.screenUpdateFlags(Update::FitCursor); break; }