When the cursor is not visible on screen (probably caused by scrolling
with the scrollbar), the cursor is painted at the location (-1,-1+asc).
However, this can be seen on the screen (at least on windows).
The attached patch solves this problem.
If there are no comments / suggestions, I'll put it in (and in branch ?).
Vincent
Index: src/BufferView.cpp
===================================================================
--- src/BufferView.cpp (revision 27602)
+++ src/BufferView.cpp (working copy)
@@ -2218,10 +2218,11 @@
Point BufferView::getPos(DocIterator const & dit, bool boundary) const
{
+ if (!paragraphVisible(dit))
+ return Point(-1, -1);
+
CursorSlice const & bot = dit.bottom();
TextMetrics const & tm = textMetrics(bot.text());
- if (!tm.contains(bot.pit()))
- return Point(-1, -1);
Point p = coordOffset(dit, boundary); // offset from outer paragraph
p.y_ += tm.parMetrics(bot.pit()).position();
@@ -2229,6 +2230,15 @@
}
+bool BufferView::paragraphVisible(DocIterator const & dit) const
+{
+ CursorSlice const & bot = dit.bottom();
+ TextMetrics const & tm = textMetrics(bot.text());
+
+ return tm.contains(bot.pit());
+}
+
+
void BufferView::draw(frontend::Painter & pain)
{
if (height_ == 0 || width_ == 0)
Index: src/TextMetrics.cpp
===================================================================
--- src/TextMetrics.cpp (revision 27602)
+++ src/TextMetrics.cpp (working copy)
@@ -321,15 +321,9 @@
if (pos == 0)
return false;
- Paragraph const & par = text_->getPar(pit);
+ Font const & left_font = displayFont(pit, pos - 1);
- bool left = displayFont(pit, pos - 1).isVisibleRightToLeft();
- bool right;
- if (pos == par.size())
- right = par.isRTL(bv_->buffer().params());
- else
- right = displayFont(pit, pos).isVisibleRightToLeft();
- return left != right;
+ return isRTLBoundary(pit, pos, left_font);
}
Index: src/frontends/qt4/GuiWorkArea.cpp
===================================================================
--- src/frontends/qt4/GuiWorkArea.cpp (revision 27602)
+++ src/frontends/qt4/GuiWorkArea.cpp (working copy)
@@ -567,7 +567,8 @@
// if it doesn't touch the screen, don't try to show it
bool cursorInView = true;
- if (y + h < 0 || y >= viewport()->height())
+ if (y + h < 0 || y >= viewport()->height()
+ || !cur.bv().paragraphVisible(cur))
cursorInView = false;
// show cursor on screen
Index: src/frontends/qt4/GuiTabular.cpp
===================================================================
--- src/frontends/qt4/GuiTabular.cpp (revision 27602)
+++ src/frontends/qt4/GuiTabular.cpp (working copy)
@@ -91,7 +91,7 @@
connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this,
SLOT(ltLastFooterBorderBelow_clicked()));
connect(lastfooterNoContentsCB, SIGNAL(clicked()), this,
SLOT(ltLastFooterEmpty_clicked()));
connect(specialAlignmentED, SIGNAL(returnPressed()), this,
SLOT(specialAlignment_changed()));
- connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
+ connect(widthED, SIGNAL(editingFinished()), this,
SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)), this,
SLOT(width_changed()));
connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
@@ -102,9 +102,8 @@
connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell()));
connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular()));
- bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
- bc().setCancel(closePB);
-
+ bc().setPolicy(ButtonPolicy::IgnorantPolicy);
+
bc().addReadOnly(topspaceED);
bc().addReadOnly(topspaceUnit);
bc().addReadOnly(topspaceCO);
@@ -751,11 +750,11 @@
valign = 2;
break;
default:
- valign = 1;
+ valign = 0;
break;
}
if (pwidth.zero())
- valign = 1;
+ valign = 0;
vAlignCB->setCurrentIndex(valign);
hAlignCB->setEnabled(true);
Index: src/BufferView.h
===================================================================
--- src/BufferView.h (revision 27602)
+++ src/BufferView.h (working copy)
@@ -251,6 +251,8 @@
///
Point getPos(DocIterator const & dit, bool boundary) const;
+ /// is the paragraph of the cursor visible ?
+ bool paragraphVisible(DocIterator const & dit) const;
///