Juergen Spitzmueller wrote: > > Yes, I guess os. > > Thanks. I'll add bold FIXME's.
I've just applied the attached patch. Jürgen
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2267 diff -u -r1.2267 ChangeLog --- ChangeLog 5 Sep 2005 06:50:40 -0000 1.2267 +++ ChangeLog 6 Sep 2005 17:02:22 -0000 @@ -1,8 +1,16 @@ +2005-09-06 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * CutAndPaste.[Ch]: new methods dirtyTabularStack and + tabularStackDirty to work around bug 1919 (tabular needs + to know whether its own cell paste buffer or the one of + texted is newer. + * CutAndPaste.C: mark tabular_stack_ clean after copy. + 2005-08-26 Georg Baum <[EMAIL PROTECTED]> * text2.C (cursorEnd): check for empty text (fixes bug 1998) -2005-08-19 Lars Gullik Bjønnes <[EMAIL PROTECTED]> +2005-08-19 Lars Gullik Bjønnes <[EMAIL PROTECTED]> * CutAndPaste.C (eraseSelectionHelper): fix bug 1920 use old deleteion algorithm when changetracking is on. Index: CutAndPaste.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/CutAndPaste.C,v retrieving revision 1.156 diff -u -r1.156 CutAndPaste.C --- CutAndPaste.C 19 Aug 2005 16:22:22 -0000 1.156 +++ CutAndPaste.C 6 Sep 2005 17:02:23 -0000 @@ -68,6 +68,11 @@ CutStack theCuts(10); +// store whether the tabular stack is newer than the normal copy stack +// FIXME: this is a workaround for bug 1919. Should be removed for 1.5, +// when we (hopefully) have a one-for-all paste mechanism. +bool dirty_tabular_stack_; + class resetOwnerAndChanges : public std::unary_function<Paragraph, void> { public: void operator()(Paragraph & p) const { @@ -531,6 +536,9 @@ // need a valid cursor. (Lgb) cur.clearSelection(); updateCounters(cur.buffer()); + + // tell tabular that a recent copy happened + dirtyTabularStack(false); } if (cur.inMathed()) { @@ -581,6 +589,8 @@ pars.back().insert(0, grabSelection(cur), LyXFont()); theCuts.push(make_pair(pars, bp.textclass)); } + // tell tabular that a recent copy happened + dirtyTabularStack(false); } @@ -776,6 +786,18 @@ data = "unknown selection 2"; } return data; +} + + +void dirtyTabularStack(bool b) +{ + dirty_tabular_stack_ = b; +} + + +bool tabularStackDirty() +{ + return dirty_tabular_stack_; } Index: CutAndPaste.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/CutAndPaste.h,v retrieving revision 1.39 diff -u -r1.39 CutAndPaste.h --- CutAndPaste.h 4 May 2005 11:21:13 -0000 1.39 +++ CutAndPaste.h 6 Sep 2005 17:02:23 -0000 @@ -81,6 +81,17 @@ void selClearOrDel(LCursor & cur); /// pastes n-th element of cut buffer void selPaste(LCursor & cur, size_t n); + +/** Tabular has its own paste stack for multiple cells + * but it needs to know whether there is a more recent + * ordinary paste. Therefore which one is newer. + */ +//FIXME: this is a workaround for bug 1919. Replace this by +//an all-for-one-paste mechanism in 1.5 +/// store whether tabular or ordinary paste stack is newer +void dirtyTabularStack(bool b); +/// is the tabular paste stack newer than the ordinary one? +bool tabularStackDirty(); } // namespace cap } // namespce lyx Index: insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.1179 diff -u -r1.1179 ChangeLog --- insets/ChangeLog 7 Aug 2005 18:36:20 -0000 1.1179 +++ insets/ChangeLog 6 Sep 2005 17:02:43 -0000 @@ -1,3 +1,8 @@ +2005-09-06 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * insettabular.C: mark tabular_stack_ (of CutAndPaste) dirty + after copying several cells (works around bug 1919). + 2005-08-07 Martin Vermeer <[EMAIL PROTECTED]> * insettabular.C (getStatus): fix Helge's bug that a number of insets Index: insets/insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.483 diff -u -r1.483 insettabular.C --- insets/insettabular.C 7 Aug 2005 18:36:21 -0000 1.483 +++ insets/insettabular.C 6 Sep 2005 17:02:47 -0000 @@ -16,6 +16,7 @@ #include "bufferparams.h" #include "BufferView.h" #include "cursor.h" +#include "CutAndPaste.h" #include "coordcache.h" #include "debug.h" #include "dispatchresult.h" @@ -45,6 +46,8 @@ #include <iostream> #include <limits> +using lyx::cap::tabularStackDirty; + using lyx::graphics::PreviewLoader; using lyx::support::ltrim; @@ -719,7 +722,7 @@ } case LFUN_PASTE: - if (hasPasteBuffer()) { + if (hasPasteBuffer() && tabularStackDirty()) { recordUndo(cur, Undo::INSERT); pasteSelection(cur); break; @@ -1719,6 +1722,11 @@ OutputParams const runparams; paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t'); cur.bv().stuffClipboard(os.str()); + // mark tabular stack dirty + // FIXME: this is a workaround for bug 1919. Should be removed for 1.5, + // when we (hopefully) have a one-for-all paste mechanism. + lyx::cap::dirtyTabularStack(true); + return true; }