mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fix deleting of paragraphs after undo (fix #236).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2ff6a61669
commit
870b665955
@ -1,3 +1,14 @@
|
||||
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
|
||||
|
11
src/text.C
11
src/text.C
@ -1690,7 +1690,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
|
||||
&& 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
|
||||
//
|
||||
@ -1781,8 +1781,7 @@ void LyXText::redoParagraph(BufferView * bview) const
|
||||
* 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
|
||||
@ -2545,8 +2544,7 @@ void LyXText::changeRegionCase(BufferView * bview,
|
||||
{
|
||||
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();
|
||||
@ -2588,8 +2586,7 @@ void LyXText::transposeChars(BufferView & bview)
|
||||
{
|
||||
Paragraph * tmppar = cursor.par();
|
||||
|
||||
setUndo(&bview, Undo::FINISH,
|
||||
tmppar, tmppar->next());
|
||||
setUndo(&bview, Undo::FINISH, tmppar, tmppar->next());
|
||||
|
||||
pos_type tmppos = cursor.pos();
|
||||
|
||||
|
14
src/text2.C
14
src/text2.C
@ -2057,6 +2057,17 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * 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);
|
||||
@ -2106,8 +2117,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par,
|
||||
!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 +
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "iterators.h"
|
||||
|
||||
//#define DELETE_UNUSED_PARAGRAPHS 1
|
||||
#define DELETE_UNUSED_PARAGRAPHS 1
|
||||
#ifdef DELETE_UNUSED_PARAGRAPHS
|
||||
#include <vector>
|
||||
#endif
|
||||
@ -275,17 +275,27 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
|
||||
// And here it's save enough to delete all removed paragraphs
|
||||
vector<Paragraph *>::iterator pit = vvpar.begin();
|
||||
if (pit != vvpar.end()) {
|
||||
lyxerr << "DEL: ";
|
||||
for(;pit != vvpar.end(); ++pit) {
|
||||
lyxerr << *pit << " ";
|
||||
delete (*pit);
|
||||
}
|
||||
lyxerr << endl << "PARS:";
|
||||
#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 << " ";
|
||||
lyxerr << endl;
|
||||
lyxerr << (*it)->previous() << "<- " << (*it) << " ->" << (*it)->next() << endl;
|
||||
lyxerr << "DEL: ";
|
||||
#endif
|
||||
for(;pit != vvpar.end(); ++pit) {
|
||||
// lyxerr << *pit << " ";
|
||||
(*pit)->previous(0);
|
||||
(*pit)->next(0);
|
||||
delete (*pit);
|
||||
}
|
||||
#if 0
|
||||
lyxerr << endl << "PARS AFTER:";
|
||||
end = bv->buffer()->par_iterator_end();
|
||||
it = bv->buffer()->par_iterator_begin();
|
||||
for (; it != end; ++it)
|
||||
lyxerr << (*it)->previous() << "<- " << (*it) << " ->" << (*it)->next() << endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user