+2002-03-14 Juergen Vigna <jug@sad.it>
+
+ * text2.C (setCursor): just some testcode for #44 not ready yet.
+
+ * undo_funcs.C (textHandleUndo): set the next() and previous()
+ pointers of the paragraph to 0 before deleting otherwise we have
+ problems with the Paragraph::[destructor].
+
+ * text.C (breakParagraph): IMO we should ALWAYS force a real undo
+ on a paragraph insertion.
+
2002-03-14 Lars Gullik Bjønnes <larsbj@birdstep.com>
* buffer.C (asciiParagraph): use += operator for char append to
&& layout.labeltype!= LABEL_SENSITIVE)
return;
- setUndo(bview, Undo::INSERT,cursor.par(),cursor.par()->next());
+ setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
// Always break behind a space
//
* same Paragraph one to the right and make a rebreak */
void LyXText::insertChar(BufferView * bview, char c)
{
- setUndo(bview, Undo::INSERT,
- cursor.par(), cursor.par()->next());
+ setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next());
// When the free-spacing option is set for the current layout,
// disable the double-space checking
{
lyx::Assert(from <= to);
- setUndo(bview, Undo::FINISH,
- from.par(), to.par()->next());
+ setUndo(bview, Undo::FINISH, from.par(), to.par()->next());
pos_type pos = from.pos();
Paragraph * par = from.par();
{
Paragraph * tmppar = cursor.par();
- setUndo(&bview, Undo::FINISH,
- tmppar, tmppar->next());
+ setUndo(&bview, Undo::FINISH, tmppar, tmppar->next());
pos_type tmppos = cursor.pos();
// to make sure undo gets the right cursor position
cursor = old_cursor;
setUndo(bview, Undo::DELETE,
- cursor.par(), cursor.par()->next());
+ cursor.par(), cursor.par()->next());
cursor = tmpcursor;
backspace(bview);
}
void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par,
- pos_type pos, bool boundary) const
+ pos_type pos, bool boundary) const
{
lyx::Assert(par);
lyx::Assert(bview);
-
+
cur.par(par);
cur.pos(pos);
cur.boundary(boundary);
+#if 0
+ if (pos && par->getChar(pos) == Paragraph::META_INSET &&
+ par->getInset(pos)) {
+ Inset * ins = par->getInset(pos);
+ if (ins->needFullRow() || ins->display()) {
+ --pos;
+ boundary = true;
+ }
+ }
+#endif
+
// get the cursor y position in text
int y = 0;
Row * row = getRow(par, pos, y);
}
if (last < row->pos())
- cursor_vpos = row->pos();
+ cursor_vpos = row->pos();
else if (pos > last && !boundary)
cursor_vpos = (row->par()->isRightToLeftPar(bview->buffer()->params))
? row->pos() : last + 1;
else if (pos > row->pos() &&
- (pos > last || boundary))
+ (pos > last || boundary))
/// Place cursor after char at (logical) position pos - 1
cursor_vpos = (bidi_level(pos - 1) % 2 == 0)
? log2vis(pos - 1) + 1 : log2vis(pos - 1);
!row->par()->isLineSeparator(main_body-1)))
main_body = 0;
- for (pos_type vpos = row->pos();
- vpos < cursor_vpos; ++vpos) {
+ for (pos_type vpos = row->pos(); vpos < cursor_vpos; ++vpos) {
pos = vis2log(vpos);
if (main_body > 0 && pos == main_body - 1) {
x += fill_label_hfill +
#include "iterators.h"
-//#define DELETE_UNUSED_PARAGRAPHS 1
+#define DELETE_UNUSED_PARAGRAPHS 1
#ifdef DELETE_UNUSED_PARAGRAPHS
#include <vector>
#endif
// And here it's save enough to delete all removed paragraphs
vector<Paragraph *>::iterator pit = vvpar.begin();
if (pit != vvpar.end()) {
+#if 0
+ lyxerr << endl << "PARS BEFORE:";
+ ParIterator end = bv->buffer()->par_iterator_end();
+ ParIterator it = bv->buffer()->par_iterator_begin();
+ for (; it != end; ++it)
+ lyxerr << (*it)->previous() << "<- " << (*it) << " ->" << (*it)->next() << endl;
lyxerr << "DEL: ";
+#endif
for(;pit != vvpar.end(); ++pit) {
- lyxerr << *pit << " ";
+// lyxerr << *pit << " ";
+ (*pit)->previous(0);
+ (*pit)->next(0);
delete (*pit);
}
- lyxerr << endl << "PARS:";
- ParIterator end = bv->buffer()->par_iterator_end();
- ParIterator it = bv->buffer()->par_iterator_begin();
+#if 0
+ lyxerr << endl << "PARS AFTER:";
+ end = bv->buffer()->par_iterator_end();
+ it = bv->buffer()->par_iterator_begin();
for (; it != end; ++it)
- lyxerr << *it << " ";
- lyxerr << endl;
+ lyxerr << (*it)->previous() << "<- " << (*it) << " ->" << (*it)->next() << endl;
+#endif
}
#endif
}