mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
op-1-a.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6821 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2b27114a4e
commit
1c1473e7ec
@ -1,3 +1,11 @@
|
||||
2003-04-16 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* undo_funcs.C (textHandleUndo): ajust (rather big adsjust this one)
|
||||
|
||||
* text2.C (deleteEmptyParagraphMechanism): adjust
|
||||
|
||||
* text2.[Ch] (ownerParagraph): delete func (both of them
|
||||
|
||||
2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* text_funcs.C (transposeChars): use ParagraphList::iterator here.
|
||||
|
@ -168,6 +168,8 @@ void ParagraphList::erase(ParagraphList::iterator it)
|
||||
if (next)
|
||||
next->previous_ = prev;
|
||||
|
||||
it->previous_ = 0;
|
||||
it->next_ = 0;
|
||||
delete &*it;
|
||||
#else
|
||||
Paragraph * prev = it->prev_par_;
|
||||
|
@ -633,10 +633,6 @@ public:
|
||||
// special owner functions
|
||||
///
|
||||
ParagraphList & ownerParagraphs() const;
|
||||
//
|
||||
void ownerParagraph(Paragraph *) const;
|
||||
// set it searching first for the right owner using the paragraph id
|
||||
void ownerParagraph(int id, Paragraph *) const;
|
||||
|
||||
/// return true if this is owned by an inset.
|
||||
bool isInInset() const;
|
||||
|
40
src/text2.C
40
src/text2.C
@ -2254,6 +2254,10 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
||||
|
||||
deleted = true;
|
||||
|
||||
bool selection_position_was_oldcursor_position = (
|
||||
selection.cursor.par() == old_cursor.par()
|
||||
&& selection.cursor.pos() == old_cursor.pos());
|
||||
|
||||
if (old_cursor.row() != rows().begin()) {
|
||||
RowList::iterator
|
||||
prevrow = boost::prior(old_cursor.row());
|
||||
@ -2272,12 +2276,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
||||
|
||||
// delete old row
|
||||
removeRow(old_cursor.row());
|
||||
if (ownerParagraphs().begin() == old_cursor.par()) {
|
||||
ownerParagraph(&*boost::next(ownerParagraphs().begin()));
|
||||
}
|
||||
#warning FIXME Do the proper ParagraphList operation here (Lgb)
|
||||
// delete old par
|
||||
delete &*old_cursor.par();
|
||||
ownerParagraphs().erase(old_cursor.par());
|
||||
|
||||
/* Breakagain the next par. Needed because of
|
||||
* the parindent that can occur or dissappear.
|
||||
@ -2308,11 +2308,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
||||
// delete old row
|
||||
removeRow(old_cursor.row());
|
||||
// delete old par
|
||||
if (ownerParagraphs().begin() == old_cursor.par()) {
|
||||
ownerParagraph(&*boost::next(ownerParagraphs().begin()));
|
||||
}
|
||||
#warning FIXME Do the proper ParagraphList operations here. (Lgb)
|
||||
delete &*old_cursor.par();
|
||||
ownerParagraphs().erase(old_cursor.par());
|
||||
|
||||
/* Breakagain the next par. Needed because of
|
||||
the parindent that can occur or dissappear.
|
||||
@ -2327,8 +2323,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
||||
// correct cursor y
|
||||
setCursorIntern(cursor.par(), cursor.pos());
|
||||
|
||||
if (selection.cursor.par() == old_cursor.par()
|
||||
&& selection.cursor.pos() == old_cursor.pos()) {
|
||||
if (selection_position_was_oldcursor_position) {
|
||||
// correct selection
|
||||
selection.cursor = cursor;
|
||||
}
|
||||
@ -2354,27 +2349,6 @@ ParagraphList & LyXText::ownerParagraphs() const
|
||||
}
|
||||
|
||||
|
||||
void LyXText::ownerParagraph(Paragraph * p) const
|
||||
{
|
||||
if (inset_owner) {
|
||||
inset_owner->paragraph(p);
|
||||
} else {
|
||||
bv_owner->buffer()->paragraphs.set(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXText::ownerParagraph(int id, Paragraph * p) const
|
||||
{
|
||||
Paragraph * op = bv_owner->buffer()->getParFromID(id);
|
||||
if (op && op->inInset()) {
|
||||
static_cast<InsetText *>(op->inInset())->paragraph(p);
|
||||
} else {
|
||||
ownerParagraph(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LyXText::refresh_status LyXText::refreshStatus() const
|
||||
{
|
||||
return refresh_status_;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "insets/updatableinset.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "debug.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
@ -166,17 +167,28 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
undopar->previous(before);
|
||||
if (before)
|
||||
before->next(undopar);
|
||||
else
|
||||
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
||||
undopar);
|
||||
|
||||
else {
|
||||
int id = firstUndoParagraph(bv, undo.number_of_inset_id)->id();
|
||||
Paragraph * op = bv->buffer()->getParFromID(id);
|
||||
if (op && op->inInset()) {
|
||||
static_cast<InsetText*>(op->inInset())->paragraph(undopar);
|
||||
} else {
|
||||
bv->buffer()->paragraphs.set(undopar);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We enter here on DELETE undo operations where we have to
|
||||
// substitue the second paragraph with the first if the removed
|
||||
// one is the first!
|
||||
if (!before && behind) {
|
||||
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
||||
behind);
|
||||
int id = firstUndoParagraph(bv, undo.number_of_inset_id)->id();
|
||||
Paragraph * op = bv->buffer()->getParFromID(id);
|
||||
if (op && op->inInset()) {
|
||||
static_cast<InsetText*>(op->inInset())->paragraph(behind);
|
||||
} else {
|
||||
bv->buffer()->paragraphs.set(behind);
|
||||
}
|
||||
|
||||
undopar = behind;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user