This is (more or less) part of the somewhat larger undo patch I send some time ago.
It's not only whitespace stuff, making 'pop' more STL like, and removal of some spurious 'using lyx::pos_type' It serves only as a measure to remove distraction ("Gosh... why two spaces here") when reading undostack.C... Andre' -- André Pönitz .............................................. [EMAIL PROTECTED]
Index: undo_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo_funcs.C,v retrieving revision 1.9 diff -u -p -r1.9 undo_funcs.C --- undo_funcs.C 2001/12/13 11:35:25 1.9 +++ undo_funcs.C 2001/12/13 17:02:26 @@ -26,10 +26,12 @@ bool undo_finished; /// a flag bool undo_frozen; + bool textUndo(BufferView * bv) { // returns false if no undo possible - Undo * undo = bv->buffer()->undostack.pop(); + Undo * undo = bv->buffer()->undostack.top(); + bv->buffer()->undostack.pop(); if (undo) { finishUndo(); if (!undo_frozen) { @@ -50,7 +52,8 @@ bool textUndo(BufferView * bv) bool textRedo(BufferView * bv) { // returns false if no redo possible - Undo * undo = bv->buffer()->redostack.pop(); + Undo * undo = bv->buffer()->redostack.top(); + bv->buffer()->redostack.pop(); if (undo) { finishUndo(); if (!undo_frozen) { @@ -247,7 +250,6 @@ void setRedo(BufferView * bv, Undo::undo bv->buffer()->redostack.push(createUndo(bv, kind, first, behind)); } -using lyx::pos_type; Undo * createUndo(BufferView * bv, Undo::undo_kind kind, Paragraph const * first, Paragraph const * behind) @@ -276,8 +278,8 @@ Undo * createUndo(BufferView * bv, Undo: // check wether storing is needed if (!bv->buffer()->undostack.empty() && bv->buffer()->undostack.top()->kind == kind && - bv->buffer()->undostack.top()->number_of_before_par == before_number && - bv->buffer()->undostack.top()->number_of_behind_par == behind_number ){ + bv->buffer()->undostack.top()->number_of_before_par == +before_number && + bv->buffer()->undostack.top()->number_of_behind_par == +behind_number) { // no undo needed return 0; } @@ -345,6 +347,7 @@ void setCursorParUndo(BufferView * bv) bv->text->cursor.par()->next()); } + Paragraph * firstUndoParagraph(BufferView * bv, int inset_id) { Inset * inset = bv->buffer()->getInsetFromID(inset_id); @@ -355,6 +358,7 @@ Paragraph * firstUndoParagraph(BufferVie } return bv->text->ownerParagraph(); } + LyXCursor const & undoCursor(BufferView * bv) { Index: undostack.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undostack.C,v retrieving revision 1.1 diff -u -p -r1.1 undostack.C --- undostack.C 2001/06/25 00:06:21 1.1 +++ undostack.C 2001/12/13 17:02:26 @@ -23,18 +23,18 @@ UndoStack::UndoStack() : limit(100) {} -Undo * UndoStack::pop() +void UndoStack::pop() { - if (stakk.empty()) return 0; - Undo * result = stakk.front(); + if (stakk.empty()) + return; stakk.pop_front(); - return result; } -Undo * UndoStack::top() +Undo * UndoStack::top() const { - if (stakk.empty()) return 0; + if (stakk.empty()) + return 0; return stakk.front(); } @@ -63,7 +63,8 @@ void UndoStack::SetStackLimit(Stakk::siz void UndoStack::push(Undo * undo_arg) { - if (!undo_arg) return; + if (!undo_arg) + return; stakk.push_front(undo_arg); if (stakk.size() > limit) { @@ -74,6 +75,7 @@ void UndoStack::push(Undo * undo_arg) } -bool UndoStack::empty() const { +bool UndoStack::empty() const +{ return stakk.empty(); } Index: undostack.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undostack.h,v retrieving revision 1.1 diff -u -p -r1.1 undostack.h --- undostack.h 2001/06/25 00:06:21 1.1 +++ undostack.h 2001/12/13 17:02:26 @@ -33,13 +33,13 @@ public: /// UndoStack(); /// - Undo * pop(); + ~UndoStack(); /// - Undo * top(); + void pop(); /// - bool empty() const; + Undo * top() const; /// - ~UndoStack(); + bool empty() const; /// void clear(); ///