mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
supposedly fix some getchar problems, and reenable the stronger assert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6532 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
561bf82e7a
commit
19fb963cc8
@ -252,29 +252,24 @@ void Paragraph::Pimpl::rejectChange(pos_type start, pos_type end)
|
||||
|
||||
Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
|
||||
{
|
||||
lyx::Assert(pos <= size());
|
||||
|
||||
// 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 (lyxerr.debugging(Debug::LYXVC))
|
||||
lyx::Assert(pos < size());
|
||||
#if 1
|
||||
#if 0
|
||||
// This is in the critical path for loading!
|
||||
pos_type const siz = size();
|
||||
|
||||
lyx::Assert(pos <= siz);
|
||||
|
||||
if (pos == siz) {
|
||||
lyxerr << "getChar() on pos " << pos << " in par id "
|
||||
<< owner_->id() << " of size " << siz
|
||||
<< " is a bit silly !" << endl;
|
||||
<< owner_->id() << " of size " << siz
|
||||
<< " is a bit silly !" << endl;
|
||||
return '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
return text[pos];
|
||||
#else
|
||||
lyx::Assert(pos < size());
|
||||
return text[pos];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
13
src/text.C
13
src/text.C
@ -78,7 +78,7 @@ int LyXText::top_y() const
|
||||
return 0;
|
||||
|
||||
int y = 0;
|
||||
for (Row * row = firstrow;
|
||||
for (Row * row = firstrow;
|
||||
row && row != anchor_row_; row = row->next()) {
|
||||
y += row->height();
|
||||
}
|
||||
@ -112,10 +112,10 @@ void LyXText::anchor_row(Row * row)
|
||||
{
|
||||
int old_y = top_y();
|
||||
anchor_row_offset_ = 0;
|
||||
anchor_row_ = row;
|
||||
anchor_row_ = row;
|
||||
anchor_row_offset_ = old_y - top_y();
|
||||
lyxerr[Debug::GUI] << "anchor_row(): changing reference to row: "
|
||||
<< anchor_row_ << " offset: " << anchor_row_offset_
|
||||
lyxerr[Debug::GUI] << "anchor_row(): changing reference to row: "
|
||||
<< anchor_row_ << " offset: " << anchor_row_offset_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -1665,8 +1665,8 @@ void LyXText::insertChar(char c)
|
||||
if (row->previous() && row->previous()->par() == row->par()
|
||||
&& (cursor.par()->isLineSeparator(cursor.pos())
|
||||
|| cursor.par()->isNewline(cursor.pos())
|
||||
|| ((cursor.pos() < cursor.par()->size()) &&
|
||||
cursor.par()->isInset(cursor.pos()+1))
|
||||
|| ((cursor.pos() + 1 < cursor.par()->size()) &&
|
||||
cursor.par()->isInset(cursor.pos() + 1))
|
||||
|| cursor.row()->fill() == -1))
|
||||
{
|
||||
pos_type z = rowBreakPoint(*row->previous());
|
||||
@ -2628,6 +2628,7 @@ void LyXText::backspace()
|
||||
|
||||
// delete newlines at the beginning of paragraphs
|
||||
while (!cursor.par()->empty() &&
|
||||
cursor.pos() < cursor.par()->size() &&
|
||||
cursor.par()->isNewline(cursor.pos()) &&
|
||||
cursor.pos() == cursor.par()->beginningOfBody()) {
|
||||
cursor.par()->erase(cursor.pos());
|
||||
|
Loading…
Reference in New Issue
Block a user