-src/BufferView.C
-src/BufferView_pimpl.C
-src/Chktex.C
-src/CutAndPaste.C
-src/LColor.C
-src/LaTeX.C
-src/LyXAction.C
-src/MenuBackend.C
src/buffer.C
src/bufferlist.C
+src/BufferView.C
src/bufferview_funcs.C
+src/BufferView_pimpl.C
+src/Chktex.C
src/converter.C
+src/CutAndPaste.C
src/debug.C
src/exporter.C
src/format.C
-src/frontends/LyXView.C
-src/frontends/controllers/ButtonController.h
+src/frontends/controllers/biblio.C
+src/frontends/controllers/character.C
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlCharacter.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/controllers/ControlVCLog.C
-src/frontends/controllers/biblio.C
-src/frontends/controllers/character.C
src/frontends/controllers/frnt_lang.C
src/frontends/controllers/helper_funcs.C
src/frontends/gnome/GLog.C
+src/frontends/LyXView.C
src/frontends/qt2/Alert_pimpl.C
src/frontends/qt2/Dialogs3.C
src/frontends/qt2/FileDialog.C
+src/frontends/qt2/lengthcombo.C
src/frontends/qt2/QAbout.C
src/frontends/qt2/QBibitem.C
src/frontends/qt2/QBibtex.C
src/frontends/qt2/QDelimiterDialog.C
src/frontends/qt2/QDocument.C
src/frontends/qt2/QDocumentDialog.C
-src/frontends/qt2/QERT.C
src/frontends/qt2/QError.C
+src/frontends/qt2/QERT.C
src/frontends/qt2/QExternal.C
src/frontends/qt2/QExternalDialog.C
src/frontends/qt2/QFloat.C
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QGraphicsDialog.C
src/frontends/qt2/QInclude.C
-src/frontends/qt2/QLPrintDialog.C
src/frontends/qt2/QLog.C
+src/frontends/qt2/QLPrintDialog.C
src/frontends/qt2/QMathDialog.C
src/frontends/qt2/QMathMatrixDialog.C
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QSendto.C
src/frontends/qt2/QShowFile.C
src/frontends/qt2/QSpellchecker.C
+src/frontends/qt2/Qt2BC.h
src/frontends/qt2/QTabular.C
src/frontends/qt2/QTabularCreate.C
src/frontends/qt2/QTexinfo.C
src/frontends/qt2/QThesaurus.C
src/frontends/qt2/QToc.C
+src/frontends/qt2/QtView.C
src/frontends/qt2/QURL.C
src/frontends/qt2/QVCLog.C
src/frontends/qt2/QWrap.C
-src/frontends/qt2/QtView.C
-src/frontends/qt2/lengthcombo.C
src/frontends/xforms/Alert_pimpl.C
src/frontends/xforms/ColorHandler.C
+src/frontends/xforms/combox.C
src/frontends/xforms/Dialogs3.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/FormAboutlyx.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormDialogView.C
src/frontends/xforms/FormDocument.C
-src/frontends/xforms/FormERT.C
src/frontends/xforms/FormError.C
+src/frontends/xforms/FormERT.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormFloat.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/FormWrap.C
-src/frontends/xforms/Menubar_pimpl.C
-src/frontends/xforms/XMiniBuffer.C
-src/frontends/xforms/combox.C
src/frontends/xforms/input_validators.C
+src/frontends/xforms/Menubar_pimpl.C
+src/frontends/xforms/xformsBC.h
src/frontends/xforms/xforms_helpers.C
+src/frontends/xforms/XMiniBuffer.C
src/gettext.h
src/importer.C
-src/insets/inset.C
src/insets/insetbibtex.C
+src/insets/inset.C
src/insets/insetcaption.C
src/insets/inseterror.C
src/insets/insetert.C
src/ispell.C
src/kbsequence.C
src/language.C
+src/LaTeX.C
+src/LColor.C
src/lengthcommon.C
+src/LyXAction.C
src/lyx_cb.C
-src/lyx_main.C
src/lyxfind.C
src/lyxfont.C
src/lyxfunc.C
+src/lyx_main.C
src/lyxrc.C
src/lyxtextclasslist.C
src/lyxvc.C
src/mathed/math_hullinset.C
src/mathed/math_parboxinset.C
src/mathed/ref_inset.C
+src/MenuBackend.C
src/paragraph.C
+src/paragraph_funcs.C
src/rowpainter.C
src/support/filetools.C
src/tabular.C
-src/text.C
src/text2.C
src/text3.C
+src/text.C
+2003-03-13 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * text2.C (setCursor): never ask for one past last
+ (setCursor): add some debugging messages.
+
+ * text.C (singleWidth): never ask for one past last
+ (singleWidth): ditto
+ (leftMargin): ditto
+ (rightMargin): ditto
+ (rowBreakPoint): ditto
+ (setHeightOfRow): ditto
+ (prepareToPrint): ditto
+
+ * rowpainter.C (paintBackground): never ask for one past last
+ (paintText): never ask for one past last
+
+ * paragraph_pimpl.C (getChar): make the assert stricter, never
+ allow the one past last pos to be taken
+
+ * paragraph.C (getChar): ws changes only
+
+ * lyxrow.C (nextRowIsAllInset): never ask for one past last
+ (numberOfSeparators): ditto
+ (numberOfHfills): ditto
+
2003-03-12 John Levon <levon@movementarian.org>
* author.h:
bool nextRowIsAllInset(Row const & row, pos_type last)
{
+ if (last + 1 >= row.par()->size())
+ return false;
+
if (!row.par()->isInset(last + 1))
return false;
pos_type p = max(pos(), par()->beginningOfBody());
int n = 0;
- for (; p <= last; ++p) {
+ for (; p < last; ++p) {
if (par()->isSeparator(p)) {
++n;
}
// hfill *DO* count at the beginning of paragraphs!
if (first) {
- while (first <= last && par()->isHfill(first)) {
+ while (first < last && par()->isHfill(first)) {
++first;
}
}
int n = 0;
// last, because the end is ignored!
- for (pos_type p = first; p <= last; ++p) {
+ for (pos_type p = first; p < last; ++p) {
if (par()->isHfill(p))
++n;
}
char previous_char = 0;
char temp = 0;
if (i < size()) {
- previous_char = getChar(i);
+ previous_char = getChar(i);
if (!isNewline(i)) {
++i;
while (i < size() && previous_char != ' ') {
value_type const c = getUChar(buffer->params, i);
if (IsPrintable(c))
os << c;
- else if (c == META_INSET)
+ else if (c == META_INSET)
getInset(i)->ascii(buffer, os);
}
pimpl_->inset_owner = i;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
if (it.getInset())
it.getInset()->setOwner(i);
}
Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
{
- // This is in the critical path for loading!
- pos_type const siz = size();
- lyx::Assert(pos <= siz);
+ //lyx::Assert(pos <= siz);
// This is stronger, and I belive that this is the assertion
// that we should really use. (Lgb)
- //Assert(pos < size());
+ lyx::Assert(pos < size());
+
+#if 0
+ // This is in the critical path for loading!
+ pos_type const siz = size();
// Then this has no meaning. (Lgb)
if (!siz || pos == siz) {
<< " is a bit silly !" << endl;
return '\0';
}
-
+#endif
return text[pos];
}
Inset const * inset = 0;
if (!bv_.screen().forceClear() && last == row_.pos()
- && par_.isInset(row_.pos())) {
+ && row_.pos() < par_.size()
+ && par_.isInset(row_.pos())) {
inset = par_.getInset(row_.pos());
clear_area = inset->doClearArea();
}
break;
pos_type pos = text_.vis2log(vpos);
+ if (pos >= par_.size()) {
+ ++vpos;
+ continue;
+ }
+
if (x_ + singleWidth(pos) < 0) {
x_ += singleWidth(pos);
++vpos;
{
if (!top_row_)
return 0;
-
+
int y = 0;
for (Row * row = firstrow; row && row != top_row_; row = row->next()) {
y += row->height();
if (!firstrow)
return;
lyxerr[Debug::GUI] << "setting top y = " << newy << endl;
-
+
int y = newy;
top_row_ = getRowNearY(y);
top_row_offset_ = newy - y;
int LyXText::singleWidth(BufferView * bview, Paragraph * par,
pos_type pos) const
{
+ if (pos >= par->size())
+ return 0;
+
char const c = par->getChar(pos);
return singleWidth(bview, par, pos, c);
}
int LyXText::singleWidth(BufferView * bview, Paragraph * par,
pos_type pos, char c) const
{
+ if (pos >= par->size())
+ return 0;
+
LyXFont const font = getFont(bview->buffer(), par, pos);
// The most common case is handled first (Asger)
int LyXText::leftMargin(BufferView * bview, Row const * row) const
{
Inset * ins;
- if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) &&
- (ins=row->par()->getInset(row->pos())) &&
- (ins->needFullRow() || ins->display()))
- return LEFT_MARGIN;
+
+ if (row->pos() < row->par()->size())
+ if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) &&
+ (ins = row->par()->getInset(row->pos())) &&
+ (ins->needFullRow() || ins->display()))
+ return LEFT_MARGIN;
LyXTextClass const & tclass =
bview->buffer()->params.getLyXTextClass();
int LyXText::rightMargin(Buffer const & buf, Row const & row) const
{
Inset * ins;
- if ((row.par()->getChar(row.pos()) == Paragraph::META_INSET) &&
- (ins=row.par()->getInset(row.pos())) &&
- (ins->needFullRow() || ins->display()))
- return PAPER_MARGIN;
+
+ if (row.pos() < row.par()->size())
+ if ((row.par()->getChar(row.pos()) == Paragraph::META_INSET) &&
+ (ins=row.par()->getInset(row.pos())) &&
+ (ins->needFullRow() || ins->display()))
+ return PAPER_MARGIN;
LyXTextClass const & tclass = buf.params.getLyXTextClass();
LyXLayout_ptr const & layout = row.par()->layout();
pos_type const body_pos = par->beginningOfBody();
pos_type const last = par->size();
pos_type point = last;
- pos_type i = pos;
+
+ if (pos == last)
+ return last;
// Now we iterate through until we reach the right margin
// or the end of the par, then choose the possible break
// pixel width since last breakpoint
int chunkwidth = 0;
- for (i = pos; i < last; ++i) {
+ pos_type i = pos;
+ for (; i < last; ++i) {
if (par->isNewline(i)) {
point = i;
if (!display)
continue;
-
+
// full row insets start at a new row
if (i == pos) {
if (pos < last - 1) {
int maxwidth = 0;
// Check if any insets are larger
- for (pos_type pos = row->pos(); pos <= pos_end; ++pos) {
+ 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);
return;
}
}
-
+
// the display inset stuff
- if (cursor.row()->par()->isInset(cursor.row()->pos())) {
+ if (cursor.row()->pos() < cursor.row()->par()->size()
+ && cursor.row()->par()->isInset(cursor.row()->pos())) {
Inset * inset = cursor.row()->par()->getInset(cursor.row()->pos());
if (inset && (inset->display() || inset->needFullRow())) {
// force a new break
// is empty.
if (!row->par()->empty())
++nlh;
-
+
if (nlh && !row->par()->getLabelWidthString().empty()) {
fill_label_hfill = labelFill(*bview, *row) / nlh;
}
// center displayed insets
Inset * inset;
- if (row->par()->isInset(row->pos())
- && (inset=row->par()->getInset(row->pos()))
+ if (row->pos() < row->par()->size()
+ && row->par()->isInset(row->pos())
+ && (inset = row->par()->getInset(row->pos()))
&& (inset->display())) // || (inset->scroll() < 0)))
align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
// Move cursor to the beginning, when not already there.
if (from.pos() && !from.par()->isSeparator(from.pos() - 1)
&& !(from.par()->isKomma(from.pos() - 1)
- || from.par()->isNewline(from.pos() - 1)))
+ || from.par()->isNewline(from.pos() - 1)))
cursorLeftOneWord(from);
break;
case PREVIOUS_WORD:
LyXText::LyXText(BufferView * bv)
- : height(0), width(0), top_row_(0), top_row_offset_(0),
+ : height(0), width(0), top_row_(0), top_row_offset_(0),
inset_owner(0), the_locking_inset(0), need_break_row(0),
refresh_y(0), refresh_row(0), bv_owner(bv),
status_(LyXText::UNCHANGED), firstrow(0), lastrow(0)
LyXText::LyXText(InsetText * inset)
- : height(0), width(0), top_row_(0), top_row_offset_(0),
+ : height(0), width(0), top_row_(0), top_row_offset_(0),
inset_owner(inset), the_locking_inset(0), need_break_row(0),
refresh_y(0), refresh_row(0), bv_owner(0),
status_(LyXText::UNCHANGED), firstrow(0), lastrow(0)
Inset * ins;
if (row->previous() && pos &&
row->previous()->par() == row->par() &&
+ pos < par->size() &&
par->getChar(pos) == Paragraph::META_INSET &&
- (ins=par->getInset(pos)) && (ins->needFullRow() || ins->display()))
+ (ins = par->getInset(pos)) && (ins->needFullRow() || ins->display()))
{
row = row->previous();
y -= row->height();
// None of these should happen, but we're scaredy-cats
if (pos > par->size()) {
+ lyxerr << "dont like 1 please report" << endl;
pos = 0;
cur.pos(0);
} else if (pos > last + 1) {
+ lyxerr << "dont like 2 please report" << endl;
// This shouldn't happen.
pos = last + 1;
cur.pos(pos);
} else if (pos < row->pos()) {
+ lyxerr << "dont like 3 please report" << endl;
pos = row->pos();
cur.pos(pos);
}