mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
fix up the getChar() fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6490 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f38cae2e9e
commit
c3fb8cffea
@ -1,3 +1,9 @@
|
||||
2003-03-13 John Levon <levon@movementarian.org>
|
||||
|
||||
* paragraph_pimpl.C: fix Andre's backing out of the strong assertion
|
||||
|
||||
* text.C: fix a getChar(pos) bug properly
|
||||
|
||||
2003-03-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* commandtags.h:
|
||||
|
@ -252,19 +252,20 @@ void Paragraph::Pimpl::rejectChange(pos_type start, pos_type end)
|
||||
|
||||
Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
|
||||
{
|
||||
// This is stronger, and I belive that this is the assertion
|
||||
// that we should really use. (Lgb)
|
||||
//lyx::Assert(pos < size());
|
||||
|
||||
#warning I believe pos() == size() is valid if the cursor is at the last position of the par. (Andre)
|
||||
lyx::Assert(pos <= size());
|
||||
|
||||
#if 0
|
||||
// This is stronger, and I belive that this is the assertion
|
||||
// that we should really use. (Lgb)
|
||||
// Rationale - getChar() is really text[]. getInset(getChar(size()))
|
||||
// makes no sense (crashes). The fact we return '\0' should be
|
||||
// evidence enough - jbl
|
||||
//lyx::Assert(pos < size());
|
||||
|
||||
#if 1
|
||||
// This is in the critical path for loading!
|
||||
pos_type const siz = size();
|
||||
|
||||
// Then this has no meaning. (Lgb)
|
||||
if (!siz || pos == siz) {
|
||||
if (pos == siz) {
|
||||
lyxerr << "getChar() on pos " << pos << " in par id "
|
||||
<< owner_->id() << " of size " << siz
|
||||
<< " is a bit silly !" << endl;
|
||||
|
30
src/text.C
30
src/text.C
@ -988,23 +988,25 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row) const
|
||||
int labeladdon = 0;
|
||||
int maxwidth = 0;
|
||||
|
||||
// Check if any insets are larger
|
||||
for (pos_type pos = row->pos(); pos < pos_end; ++pos) {
|
||||
if (row->par()->isInset(pos)) {
|
||||
tmpfont = getFont(bview->buffer(), row->par(), pos);
|
||||
tmpinset = row->par()->getInset(pos);
|
||||
if (tmpinset) {
|
||||
if (!row->par()->empty()) {
|
||||
// Check if any insets are larger
|
||||
for (pos_type pos = row->pos(); pos <= pos_end; ++pos) {
|
||||
if (row->par()->isInset(pos)) {
|
||||
tmpfont = getFont(bview->buffer(), row->par(), pos);
|
||||
tmpinset = row->par()->getInset(pos);
|
||||
if (tmpinset) {
|
||||
#if 1 // this is needed for deep update on initialitation
|
||||
tmpinset->update(bview, tmpfont);
|
||||
tmpinset->update(bview, tmpfont);
|
||||
#endif
|
||||
asc = tmpinset->ascent(bview, tmpfont);
|
||||
desc = tmpinset->descent(bview, tmpfont);
|
||||
maxwidth += tmpinset->width(bview, tmpfont);
|
||||
maxasc = max(maxasc, asc);
|
||||
maxdesc = max(maxdesc, desc);
|
||||
asc = tmpinset->ascent(bview, tmpfont);
|
||||
desc = tmpinset->descent(bview, tmpfont);
|
||||
maxwidth += tmpinset->width(bview, tmpfont);
|
||||
maxasc = max(maxasc, asc);
|
||||
maxdesc = max(maxdesc, desc);
|
||||
}
|
||||
} else {
|
||||
maxwidth += singleWidth(bview, row->par(), pos);
|
||||
}
|
||||
} else {
|
||||
maxwidth += singleWidth(bview, row->par(), pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user