+2002-03-15 Juergen Vigna <jug@sad.it>
+
+ * CutAndPaste.C (SwitchLayoutsBetweenClasses): fix the wrong use of
+ inserting an Inset into the paragraph. I know this is not the best
+ fix but we already use current_view in CutAndPaste so we will remove
+ all of it's using at the same time.
+
+ * buffer.C (sgmlError): deactivated function till it is rewritten in
+ the right mode, now it can create problems.
+
+ * paragraph.C (isLineSeparator): check if getInset returns != 0,
+ before accessing it.
+
2002-03-14 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): do the right thing when updating
#include "buffer.h"
#include "paragraph.h"
#include "ParagraphParameters.h"
+#include "lyxtext.h"
#include "lyxcursor.h"
#include "gettext.h"
#include "iterators.h"
+ textclasslist[c1].name() + _(" to ")
+ textclasslist[c2].name();
InsetError * new_inset = new InsetError(s);
- par->insertInset(0, new_inset,
- LyXFont(LyXFont::ALL_INHERIT,
- bparams.language));
+ LyXText * txt = current_view->getLyXText();
+ LyXCursor cur = txt->cursor;
+ txt->setCursorIntern(current_view, par, 0);
+ txt->insertInset(current_view, new_inset);
+ txt->fullRebreak(current_view);
+ txt->setCursorIntern(current_view, cur.par(), cur.pos());
}
}
return ret;
lex.eatLine();
string const s = _("Unknown token: ") + token
+ " " + lex.text() + "\n";
-
+ // we can do this here this way because we're actually reading
+ // the buffer and don't care about LyXText right now.
InsetError * new_inset = new InsetError(s);
par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT,
- params.language));
+ params.language));
#ifndef NO_COMPABILITY
}
// Print an error message.
void Buffer::sgmlError(Paragraph * par, int pos,
- string const & message) const
+ string const & message) const
{
+#warning This is wrong we cannot insert an inset like this!!!
+ // I guess this was Jose' so I explain you more or less why this
+ // is wrong. This way you insert something in the paragraph and
+ // don't tell it to LyXText (row rebreaking and undo handling!!!)
+ // I deactivate this code, have a look at BufferView::insertErrors
+ // how you should do this correctly! (Jug 20020315)
+#if 0
// insert an error marker in text
InsetError * new_inset = new InsetError(message);
par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT,
- params.language));
+ params.language));
+#endif
}
{
value_type const c = getChar(pos);
return IsLineSeparatorChar(c)
- || (IsInsetChar(c) && getInset(pos)->isLineSeparator());
+ || (IsInsetChar(c) && getInset(pos) &&
+ getInset(pos)->isLineSeparator());
}
endpar = endpar->next(); // because of parindents etc.
}
- setUndo(bview, Undo::EDIT,
- sstart_cur.par(), undoendpar);
+ setUndo(bview, Undo::EDIT, sstart_cur.par(), undoendpar);
// ok we have a selection. This is always between sstart_cur
// and sel_end cursor