19/09/2013 08:49, Hashini Senaratne:
I was trying to figure out what has happened with vertical scrolling. This
problem has remained for a long time as I can see. The first point this
introduced was when using,
if (&cur.textRow() == &row)
What happens is what is doing inside cur.textRow() affects the vertical
scrolling. Will you be able to give me some hints? I think this bug make the
implementation of horizontal scrolling worthless.
Dear Hashini,
Here is as promised a patch concerning vertical scrolling. If it works
correctly, please remoce Cursor::bottomRow, which is not needed anymore.
What the patch does is to test whether a row exists before reading it.
This avoid strange changes in rows that in turn confuse the vertical
scrollbar.
Please test hard. I would not be surprised if this broke something else.
JMarc
>From d40761af29b976bae550891f2ca7acaec7275588 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Fri, 20 Sep 2013 13:26:29 +0200
Subject: [PATCH] Do not recompute rows in checkCursorLeftEdge
When calling BufferView::parMetrics, rows are computed on the fly if necessary. This in turn can cause problems with vertical scrollbar. Therefore, we avoid querying rows that do not already exist in cache.
---
src/BufferView.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 7cf45f7..e567389 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2844,11 +2844,18 @@ namespace {
void checkCursorLeftEdge(PainterInfo & pi, Cursor const & cur,
ScreenUpdateStrategy & strategy)
{
- Bidi bidi;
- Row const & row = cur.bottomRow();
+ BufferView const & bv = cur.bv();
CursorSlice rowSlice = cur.bottom();
+ TextMetrics const & tm = bv.textMetrics(rowSlice.text());
+
+ // Stop if metrics have not been computed yet, since it means
+ // that there is nothing to do.
+ if (!tm.contains(rowSlice.pit()))
+ return;
+ ParagraphMetrics const & pm = tm.parMetrics(rowSlice.pit());
+ Row const & row = pm.getRow(rowSlice.pos(),
+ cur.boundary() && rowSlice == cur.top());
rowSlice.pos() = row.pos();
- BufferView const & bv = cur.bv();
// Set the row on which the cursor lives.
cur.setCurrentRowSlice(rowSlice);
@@ -2857,6 +2864,7 @@ void checkCursorLeftEdge(PainterInfo & pi, Cursor const & cur,
bool const drawing = pi.pain.isDrawingEnabled();
pi.pain.setDrawingEnabled(false);
// No need to care about vertical position.
+ Bidi bidi;
RowPainter rp(pi, bv.buffer().text(), cur.bottom().pit(), row, bidi, 0, 0);
rp.paintText();
pi.pain.setDrawingEnabled(drawing);
--
1.7.0.4