refrain from computing width in setHeightOfRow as this happens already

in rowBreakPoint before.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7976 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-10-24 09:45:07 +00:00
parent 934aeb7383
commit 3e8ce5ac6c
11 changed files with 154 additions and 201 deletions

View File

@ -362,12 +362,13 @@ string const currentState(BufferView * bv)
}
}
#ifdef DEVEL_VERSION
state << _(", Paragraph: ") << text->cursorPar()->id();
ParagraphList::iterator pit = text->cursorPar();
state << _(", Paragraph: ") << pit->id();
state << _(", Position: ") << text->cursor.pos();
RowList::iterator rit = text->cursorRow();
RowList::iterator rit = pit->getRow(text->cursor.pos());
state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->endpos());
state << _(", Inset: ");
InsetOld * inset = text->cursorPar()->inInset();
InsetOld * inset = pit->inInset();
if (inset)
state << inset << " id: " << inset->id()
<< " text: " << inset->getLyXText(bv, true)
@ -399,10 +400,11 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
if (font.language() != ignore_language ||
font.number() != LyXFont::IGNORE) {
LyXCursor & cursor = text->cursor;
text->bidi.computeTables(*text->cursorPar(), *bv->buffer(),
*text->cursorRow());
Paragraph & par = *text->cursorPar();
text->bidi.computeTables(par, *bv->buffer(),
*par.getRow(cursor.pos()));
if (cursor.boundary() !=
text->bidi.isBoundary(*bv->buffer(), *text->cursorPar(),
text->bidi.isBoundary(*bv->buffer(), par,
cursor.pos(),
text->real_current_font))
text->setCursor(cursor.par(), cursor.pos(),

View File

@ -29,6 +29,7 @@
#include "lyxrow.h"
#include "lyxtext.h"
#include "metricsinfo.h"
#include "paragraph.h"
#include "rowpainter.h"
#include "version.h"
@ -257,22 +258,22 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
int newtop = top_y;
unsigned int const vheight = workarea().workHeight();
RowList::iterator row = text->cursorRow();
Row & row = *text->cursorPar()->getRow(cursor.pos());
if (int(cursor.y() - row->baseline() + row->height() - top_y) >= vheight) {
if (row->height() < vheight
&& row->height() > vheight / 4) {
if (int(cursor.y() - row.baseline() + row.height() - top_y) >= vheight) {
if (row.height() < vheight
&& row.height() > vheight / 4) {
newtop = cursor.y()
+ row->height()
- row->baseline() - vheight;
+ row.height()
- row.baseline() - vheight;
} else {
// scroll down, the scroll region must be so big!!
newtop = cursor.y() - vheight / 2;
}
} else if (int(cursor.y() - row->baseline()) < top_y && top_y > 0) {
if (row->height() < vheight && row->height() > vheight / 4) {
newtop = cursor.y() - row->baseline();
} else if (int(cursor.y() - row.baseline()) < top_y && top_y > 0) {
if (row.height() < vheight && row.height() > vheight / 4) {
newtop = cursor.y() - row.baseline();
} else {
// scroll up
newtop = cursor.y() - vheight / 2;

View File

@ -222,8 +222,7 @@ void InsetText::read(Buffer const & buf, LyXLex & lex)
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
{
//lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
textwidth_ = mi.base.textwidth;
textwidth_ = mi.base.textwidth - 30;
BufferView * bv = mi.base.bv;
setViewCache(bv);
text_.metrics(mi, dim);
@ -1493,7 +1492,7 @@ bool InsetText::cboundary() const
RowList::iterator InsetText::crow() const
{
return text_.cursorRow();
return cpar()->getRow(cpos());
}

View File

@ -956,13 +956,14 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
if (result == FINISHED_UP) {
LyXText * text = view()->text;
RowList::iterator const rit = text->cursorRow();
if (text->isFirstRow(text->cursorPar(), *rit)) {
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
if (text->isFirstRow(pit, row)) {
#if 1
text->setCursorFromCoordinates(
text->cursor.x() + inset_x,
text->cursor.y() -
rit->baseline() - 1);
row.baseline() - 1);
text->cursor.x_fix(text->cursor.x());
#else
text->cursorUp(view());
@ -977,14 +978,15 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
if (result == FINISHED_DOWN) {
LyXText * text = view()->text;
RowList::iterator const rit = text->cursorRow();
if (text->isLastRow(text->cursorPar(), *rit)) {
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
if (text->isLastRow(pit, row)) {
#if 1
text->setCursorFromCoordinates(
text->cursor.x() + inset_x,
text->cursor.y() -
rit->baseline() +
rit->height() + 1);
row.baseline() +
row.height() + 1);
text->cursor.x_fix(text->cursor.x());
#else
text->cursorDown(view());
@ -1024,7 +1026,8 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
goto exit_with_message;
case LFUN_DOWN: {
LyXText * text = view()->text;
if (text->isLastRow(text->cursorPar(), *text->cursorRow()))
ParagraphList::iterator pit = text->cursorPar();
if (text->isLastRow(pit, *pit->getRow(text->cursor.pos())))
view()->text->cursorDown(view());
else
view()->text->cursorRight(view());

View File

@ -166,14 +166,6 @@ public:
/// only the top-level LyXText has this non-zero
BufferView * bv_owner;
private:
/// returns a pointer to a specified row.
RowList::iterator getRow(Paragraph & par, lyx::pos_type pos) const;
public:
/// returns an iterator pointing to a cursor row
RowList::iterator getRow(LyXCursor const & cursor) const;
/// convenience
RowList::iterator cursorRow() const;
/// returns an iterator pointing to a cursor paragraph
ParagraphList::iterator getPar(LyXCursor const & cursor) const;
///
@ -182,6 +174,8 @@ public:
int parOffset(ParagraphList::iterator pit) const;
/// convenience
ParagraphList::iterator cursorPar() const;
///
RowList::iterator cursorRow() const;
/** returns a pointer to the row near the specified y-coordinate
(relative to the whole text). y is set to the real beginning

View File

@ -1420,3 +1420,15 @@ bool Paragraph::allowEmpty() const
return pimpl_->inset_owner->owner()->lyxCode() == InsetOld::ERT_CODE;
return false;
}
RowList::iterator Paragraph::getRow(pos_type pos)
{
RowList::iterator rit = rows.end();
RowList::iterator const begin = rows.begin();
for (--rit; rit != begin && rit->pos() > pos; --rit)
;
return rit;
}

View File

@ -295,6 +295,10 @@ public:
ParagraphParameters & params();
///
ParagraphParameters const & params() const;
///
RowList::iterator getRow(lyx::pos_type pos);
///
InsetList insetlist;

View File

@ -390,8 +390,10 @@ void RowPainter::paintSelection()
int const endx = text_.selection.end.x();
int const starty = text_.selection.start.y();
int const endy = text_.selection.end.y();
RowList::iterator startrow = text_.getRow(text_.selection.start);
RowList::iterator endrow = text_.getRow(text_.selection.end);
ParagraphList::iterator startpit = text_.getPar(text_.selection.start);
ParagraphList::iterator endpit = text_.getPar(text_.selection.end);
RowList::iterator startrow = startpit->getRow(text_.selection.start.pos());
RowList::iterator endrow = endpit->getRow(text_.selection.end.pos());
if (text_.bidi.same_direction()) {
int x;

View File

@ -467,7 +467,9 @@ pos_type addressBreakPoint(pos_type i, Paragraph const & par)
void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const
{
// maximum pixel width of a row.
int width = workWidth() - rightMargin(*pit, *bv()->buffer(), row);
int width = workWidth()
- rightMargin(*pit, *bv()->buffer(), row)
- leftMargin(pit, row);
// inset->textWidth() returns -1 via workWidth(),
// but why ?
@ -509,7 +511,7 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const
LyXFont font = getFont(pit, i);
lyx::pos_type endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
for (; i < last; ++i) {
for ( ; i < last; ++i) {
if (pit->isNewline(i)) {
point = i;
break;
@ -667,8 +669,7 @@ int LyXText::labelFill(ParagraphList::iterator pit, Row const & row) const
BOOST_ASSERT(last > 0);
// -1 because a label ends either with a space that is in the label,
// or with the beginning of a footnote that is outside the label.
// -1 because a label ends with a space that is in the label
--last;
// a separator at this end does not count
@ -676,11 +677,8 @@ int LyXText::labelFill(ParagraphList::iterator pit, Row const & row) const
--last;
int w = 0;
pos_type i = row.pos();
while (i <= last) {
for (pos_type i = row.pos(); i <= last; ++i)
w += singleWidth(pit, i);
++i;
}
int fill = 0;
string const & labwidstr = pit->params().labelWidthString();
@ -733,65 +731,28 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
spacing_val = bv()->buffer()->params().spacing().getValue();
//lyxerr << "spacing_val = " << spacing_val << endl;
// these are minimum values
int maxasc = int(font_metrics::maxAscent(font) *
layout->spacing.getValue() * spacing_val);
int maxdesc = int(font_metrics::maxDescent(font) *
layout->spacing.getValue() * spacing_val);
pos_type const pos_end = lastPos(*pit, row);
int labeladdon = 0;
int maxwidth = 0;
if (!pit->empty()) {
// We re-use the font resolution for the entire font span when possible
LyXFont font = getFont(pit, row.pos());
lyx::pos_type endPosOfFontSpan = pit->getEndPosOfFontSpan(row.pos());
// Optimisation
Paragraph const & par = *pit;
// Check if any insets are larger
for (pos_type pos = row.pos(); pos <= pos_end; ++pos) {
// Manual inlined optimised version of common case of
// "maxwidth += singleWidth(pit, pos);"
char const c = par.getChar(pos);
if (IsPrintable(c)) {
if (pos > endPosOfFontSpan) {
// We need to get the next font
font = getFont(pit, pos);
endPosOfFontSpan = par.getEndPosOfFontSpan(pos);
}
if (! font.language()->RightToLeft()) {
maxwidth += font_metrics::width(c, font);
} else {
// Fall-back to normal case
maxwidth += singleWidth(pit, pos, c, font);
// And flush font cache
endPosOfFontSpan = 0;
}
} else {
// Special handling of insets - are any larger?
if (par.isInset(pos)) {
InsetOld const * tmpinset = par.getInset(pos);
if (tmpinset) {
maxwidth += tmpinset->width();
maxasc = max(maxasc, tmpinset->ascent());
maxdesc = max(maxdesc, tmpinset->descent());
}
} else {
// Fall-back to normal case
maxwidth += singleWidth(pit, pos, c, font);
// And flush font cache
endPosOfFontSpan = 0;
}
}
// insets may be taller
InsetList::iterator ii = pit->insetlist.begin();
InsetList::iterator iend = pit->insetlist.end();
for ( ; ii != iend; ++ii) {
if (ii->pos >= row.pos() && ii->pos < row.endpos()) {
maxasc = max(maxasc, ii->inset->ascent());
maxdesc = max(maxdesc, ii->inset->descent());
}
}
// Check if any custom fonts are larger (Asger)
// This is not completely correct, but we can live with the small,
// cosmetic error for now.
int labeladdon = 0;
pos_type const pos_end = lastPos(*pit, row);
LyXFont::FONT_SIZE maxsize =
pit->highestFontInRange(row.pos(), pos_end, size);
if (maxsize > font.size()) {
@ -984,28 +945,24 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
row.height(maxasc + maxdesc + labeladdon);
row.baseline(maxasc + labeladdon);
row.top_of_text(row.baseline() - font_metrics::maxAscent(font));
row.width(maxwidth);
if (inset_owner)
width = max(workWidth(), int(maxParagraphWidth(ownerParagraphs())));
}
void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
{
// allow only if at start or end, or all previous is new text
if (cursor.pos() && cursor.pos() != cursorPar()->size()
&& cursorPar()->isChangeEdited(0, cursor.pos()))
ParagraphList::iterator cpit = cursorPar();
if (cursor.pos() && cursor.pos() != cpit->size()
&& cpit->isChangeEdited(0, cursor.pos()))
return;
LyXTextClass const & tclass =
bv()->buffer()->params().getLyXTextClass();
LyXLayout_ptr const & layout = cursorPar()->layout();
LyXLayout_ptr const & layout = cpit->layout();
// this is only allowed, if the current paragraph is not empty or caption
// and if it has not the keepempty flag active
if (cursorPar()->empty() && !cursorPar()->allowEmpty()
if (cpit->empty() && !cpit->allowEmpty()
&& layout->labeltype != LABEL_SENSITIVE)
return;
@ -1014,9 +971,8 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
// Always break behind a space
//
// It is better to erase the space (Dekel)
if (cursor.pos() < cursorPar()->size()
&& cursorPar()->isLineSeparator(cursor.pos()))
cursorPar()->erase(cursor.pos());
if (cursor.pos() < cpit->size() && cpit->isLineSeparator(cursor.pos()))
cpit->erase(cursor.pos());
// break the paragraph
if (keep_layout)
@ -1028,21 +984,22 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
// breakParagraph call should return a bool if it inserts the
// paragraph before or behind and we should react on that one
// but we can fix this in 1.3.0 (Jug 20020509)
bool const isempty = (cursorPar()->allowEmpty() && cursorPar()->empty());
::breakParagraph(bv()->buffer()->params(), paragraphs, cursorPar(),
bool const isempty = cpit->allowEmpty() && cpit->empty();
::breakParagraph(bv()->buffer()->params(), paragraphs, cpit,
cursor.pos(), keep_layout);
#warning Trouble Point! (Lgb)
// When ::breakParagraph is called from within an inset we must
// ensure that the correct ParagraphList is used. Today that is not
// the case and the Buffer::paragraphs is used. Not good. (Lgb)
ParagraphList::iterator next_par = boost::next(cursorPar());
cpit = cursorPar();
ParagraphList::iterator next_par = boost::next(cpit);
// well this is the caption hack since one caption is really enough
if (layout->labeltype == LABEL_SENSITIVE) {
if (!cursor.pos())
// set to standard-layout
cursorPar()->applyLayout(tclass.defaultLayout());
cpit->applyLayout(tclass.defaultLayout());
else
// set to standard-layout
next_par->applyLayout(tclass.defaultLayout());
@ -1052,8 +1009,9 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
// move one row up!
// This touches only the screen-update. Otherwise we would may have
// an empty row on the screen
if (cursor.pos() && cursorRow()->pos() == cursor.pos()
&& !cursorPar()->isNewline(cursor.pos() - 1))
RowList::iterator crit = cpit->getRow(cursor.pos());
if (cursor.pos() && crit->pos() == cursor.pos()
&& !cpit->isNewline(cursor.pos() - 1))
{
cursorLeft(bv());
}
@ -1062,7 +1020,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
next_par->erase(0);
updateCounters();
redoParagraph(cursorPar());
redoParagraph(cpit);
redoParagraph(next_par);
// This check is necessary. Otherwise the new empty paragraph will
@ -1070,7 +1028,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
if (cursor.pos() || isempty)
setCursor(next_par, 0);
else
setCursor(cursorPar(), 0);
setCursor(cpit, 0);
}
@ -1257,9 +1215,8 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
} else {
align = pit->params().align();
}
InsetOld * inset = 0;
// ERT insets should always be LEFT ALIGNED on screen
inset = pit->inInset();
InsetOld * inset = pit->inInset();
if (inset && inset->owner() &&
inset->owner()->lyxCode() == InsetOld::ERT_CODE)
{
@ -1791,6 +1748,12 @@ ParagraphList::iterator LyXText::cursorPar() const
}
RowList::iterator LyXText::cursorRow() const
{
return cursorPar()->getRow(cursor.pos());
}
ParagraphList::iterator LyXText::getPar(LyXCursor const & cur) const
{
return getPar(cur.par());
@ -1807,31 +1770,6 @@ ParagraphList::iterator LyXText::getPar(int par) const
}
RowList::iterator LyXText::cursorRow() const
{
return getRow(*cursorPar(), cursor.pos());
}
RowList::iterator LyXText::getRow(LyXCursor const & cur) const
{
return getRow(*getPar(cur), cur.pos());
}
RowList::iterator LyXText::getRow(Paragraph & par, pos_type pos) const
{
RowList::iterator rit = boost::prior(par.rows.end());
RowList::iterator const begin = par.rows.begin();
while (rit != begin && rit->pos() > pos)
--rit;
return rit;
}
RowList::iterator
LyXText::getRowNearY(int y, ParagraphList::iterator & pit) const
{

View File

@ -560,13 +560,15 @@ void LyXText::clearSelection()
void LyXText::cursorHome()
{
setCursor(cursorPar(), cursorRow()->pos());
ParagraphList::iterator cpit = cursorPar();
setCursor(cpit, cpit->getRow(cursor.pos())->pos());
}
void LyXText::cursorEnd()
{
setCursor(cursorPar(), cursorRow()->endpos() - 1);
ParagraphList::iterator cpit = cursorPar();
setCursor(cpit, cpit->getRow(cursor.pos())->endpos() - 1);
}
@ -1297,7 +1299,7 @@ void LyXText::setCursor(LyXCursor & cur, paroffset_type par,
// get the cursor y position in text
ParagraphList::iterator pit = getPar(par);
Row const & row = *getRow(*pit, pos);
Row const & row = *pit->getRow(pos);
int y = pit->y + row.y_offset();
// y is now the beginning of the cursor row
@ -1408,7 +1410,7 @@ void LyXText::setCurrentFont()
--pos;
else // potentional bug... BUG (Lgb)
if (pit->isSeparator(pos)) {
if (pos > cursorRow()->pos() &&
if (pos > pit->getRow(pos)->pos() &&
bidi.level(pos) % 2 ==
bidi.level(pos - 1) % 2)
--pos;
@ -1602,9 +1604,11 @@ void LyXText::cursorRight(bool internal)
void LyXText::cursorUp(bool selecting)
{
ParagraphList::iterator cpit = cursorPar();
Row const & crow = *cpit->getRow(cursor.pos());
#if 1
int x = cursor.x_fix();
int y = cursor.y() - cursorRow()->baseline() - 1;
int y = cursor.y() - crow.baseline() - 1;
setCursorFromCoordinates(x, y);
if (!selecting) {
int topy = bv_owner->top_y();
@ -1619,18 +1623,20 @@ void LyXText::cursorUp(bool selecting)
}
#else
lyxerr << "cursorUp: y " << cursor.y() << " bl: " <<
cursorRow()->baseline() << endl;
crow.baseline() << endl;
setCursorFromCoordinates(cursor.x_fix(),
cursor.y() - cursorRow()->baseline() - 1);
cursor.y() - crow.baseline() - 1);
#endif
}
void LyXText::cursorDown(bool selecting)
{
ParagraphList::iterator cpit = cursorPar();
Row const & crow = *cpit->getRow(cursor.pos());
#if 1
int x = cursor.x_fix();
int y = cursor.y() - cursorRow()->baseline() + cursorRow()->height() + 1;
int y = cursor.y() - crow.baseline() + crow.height() + 1;
setCursorFromCoordinates(x, y);
if (!selecting) {
int topy = bv_owner->top_y();
@ -1645,29 +1651,30 @@ void LyXText::cursorDown(bool selecting)
}
#else
setCursorFromCoordinates(cursor.x_fix(),
cursor.y() - cursorRow()->baseline() + cursorRow()->height() + 1);
cursor.y() - crow.baseline() + crow.height() + 1);
#endif
}
void LyXText::cursorUpParagraph()
{
ParagraphList::iterator cpit = cursorPar();
if (cursor.pos() > 0)
setCursor(cursorPar(), 0);
else if (cursorPar() != ownerParagraphs().begin())
setCursor(boost::prior(cursorPar()), 0);
setCursor(cpit, 0);
else if (cpit != ownerParagraphs().begin())
setCursor(boost::prior(cpit), 0);
}
void LyXText::cursorDownParagraph()
{
ParagraphList::iterator par = cursorPar();
ParagraphList::iterator next_par = boost::next(par);
ParagraphList::iterator pit = cursorPar();
ParagraphList::iterator next_pit = boost::next(pit);
if (next_par != ownerParagraphs().end())
setCursor(next_par, 0);
if (next_pit != ownerParagraphs().end())
setCursor(next_pit, 0);
else
setCursor(par, par->size());
setCursor(pit, pit->size());
}

View File

@ -248,11 +248,12 @@ void LyXText::gotoInset(InsetOld::Code code, bool same_content)
void LyXText::cursorPrevious()
{
int y = bv_owner->top_y();
int y = bv()->top_y();
RowList::iterator rit = cursorRow();
ParagraphList::iterator cpit = cursorPar();
RowList::iterator crit = cpit->getRow(cursor.pos());
if (rit == firstRow()) {
if (isFirstRow(cpit, *crit)) {
if (y > 0)
bv()->updateScrollbar();
return;
@ -261,37 +262,26 @@ void LyXText::cursorPrevious()
setCursorFromCoordinates(cursor.x_fix(), y);
finishUndo();
int new_y;
if (rit == bv()->text->cursorRow()) {
if (crit == bv()->text->cursorRow()) {
// we have a row which is taller than the workarea. The
// simplest solution is to move to the previous row instead.
cursorUp(true);
return;
// This is what we used to do, so we wouldn't skip right past
// tall rows, but it's not working right now.
}
int new_y = + crit->height() - bv()->workHeight() + 1;
if (inset_owner) {
new_y = bv()->text->cursor.y()
+ bv()->theLockingInset()->insetInInsetY() + y
+ rit->height()
- bv()->workHeight() + 1;
new_y += bv()->text->cursor.y()
+ bv()->theLockingInset()->insetInInsetY() + y;
} else {
new_y = cursor.y()
- rit->baseline()
+ rit->height()
- bv()->workHeight() + 1;
new_y += cursor.y() - crit->baseline();
}
previousRow(cpit, crit);
LyXCursor cur;
ParagraphList::iterator pit = cursorPar();
rit = cursorRow();
if (isFirstRow(pit, *rit))
return;
previousRow(pit, rit);
setCursor(cur, parOffset(pit), rit->pos(), false);
if (cur.y() > bv_owner->top_y())
setCursor(cur, parOffset(cpit), crit->pos(), false);
if (cur.y() > bv()->top_y())
cursorUp(true);
bv()->updateScrollbar();
}
@ -299,21 +289,23 @@ void LyXText::cursorPrevious()
void LyXText::cursorNext()
{
int topy = bv_owner->top_y();
int topy = bv()->top_y();
RowList::iterator rit = cursorRow();
if (isLastRow(cursorPar(), *cursorRow())) {
int y = cursor.y() - rit->baseline() + cursorRow()->height();
ParagraphList::iterator cpit = cursorPar();
RowList::iterator crit = cpit->getRow(cursor.pos());
if (isLastRow(cpit, *crit)) {
int y = cursor.y() - crit->baseline() + crit->height();
if (y > topy + bv()->workHeight())
bv_owner->updateScrollbar();
bv()->updateScrollbar();
return;
}
int y = topy + bv_owner->workHeight();
int y = topy + bv()->workHeight();
if (inset_owner && !topy) {
y -= (bv_owner->text->cursor.y()
- bv_owner->top_y()
+ bv_owner->theLockingInset()->insetInInsetY());
y -= (bv()->text->cursor.y()
- bv()->top_y()
+ bv()->theLockingInset()->insetInInsetY());
}
ParagraphList::iterator dummypit;
@ -325,7 +317,7 @@ void LyXText::cursorNext()
finishUndo();
int new_y;
if (rit == bv_owner->text->cursorRow()) {
if (crit == bv()->text->cursorRow()) {
// we have a row which is taller than the workarea. The
// simplest solution is to move to the next row instead.
cursorDown(true);
@ -335,21 +327,20 @@ void LyXText::cursorNext()
#if 0
new_y = bv->top_y() + bv->workHeight();
#endif
} else {
if (inset_owner) {
new_y = bv()->text->cursor.y()
+ bv()->theLockingInset()->insetInInsetY()
+ y - rit->baseline();
} else {
new_y = cursor.y() - cursorRow()->baseline();
}
}
ParagraphList::iterator pit = cursorPar();
rit = cursorRow();
nextRow(pit, rit);
if (inset_owner) {
new_y = bv()->text->cursor.y()
+ bv()->theLockingInset()->insetInInsetY()
+ y - crit->baseline();
} else {
new_y = cursor.y() - crit->baseline();
}
nextRow(cpit, crit);
LyXCursor cur;
setCursor(cur, parOffset(pit), rit->pos(), false);
setCursor(cur, parOffset(cpit), crit->pos(), false);
if (cur.y() < bv_owner->top_y() + bv()->workHeight())
cursorDown(true);
bv()->updateScrollbar();