Makes some insetchar and backspace/delete work.
Also reintroduces the stronger assert.
Index: src/paragraph_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.C,v
retrieving revision 1.57
diff -u -p -r1.57 paragraph_pimpl.C
--- src/paragraph_pimpl.C 15 Mar 2003 15:56:07 -0000 1.57
+++ src/paragraph_pimpl.C 18 Mar 2003 23:10:52 -0000
@@ -252,29 +252,24 @@ void Paragraph::Pimpl::rejectChange(pos_
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
}
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.319
diff -u -p -r1.319 text.C
--- src/text.C 18 Mar 2003 17:12:49 -0000 1.319
+++ src/text.C 18 Mar 2003 23:10:54 -0000
@@ -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());
--
Lgb