Would people please try the attached patch and comment on it? This should also fix the hang you experience John!
I'm off, so till tomorrow, have a nice evening/day #:O) Jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen Vigna E-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ After a number of decimal places, nobody gives a damn.
Index: src/BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.216 diff -u -p -r1.216 BufferView_pimpl.C --- src/BufferView_pimpl.C 19 Mar 2002 11:17:45 -0000 1.216 +++ src/BufferView_pimpl.C 19 Mar 2002 16:41:05 -0000 @@ -748,11 +748,24 @@ void BufferView::Pimpl::tripleClick(int void BufferView::Pimpl::selectionRequested() { + static string sel; + if (!available()) return; - - string const sel(bv_->getLyXText()->selectionAsString(bv_->buffer(), - false)); + + LyXText * text = bv_->getLyXText(); + + if (text->selection.set() && + (!bv_->text->xsel_cache.set() || + text->selection.start != bv_->text->xsel_cache.start || + text->selection.end != bv_->text->xsel_cache.end)) + { + bv_->text->xsel_cache = text->selection; + sel = text->selectionAsString(bv_->buffer(), false); + } else if (!text->selection.set()) { + sel = string(); + bv_->text->xsel_cache.set(false); + } if (!sel.empty()) { workarea_.putClipboard(sel); } @@ -765,7 +778,8 @@ void BufferView::Pimpl::selectionLost() hideCursor(); toggleSelection(); bv_->getLyXText()->clearSelection(); - showCursor(); + showCursor(); + bv_->text->xsel_cache.set(false); } } @@ -1439,6 +1453,9 @@ void BufferView::Pimpl::moveCursorUpdate update(lt, BufferView::SELECT|BufferView::FITCUR); showCursor(); } + + if (!lt->selection.set()) + workarea_.haveSelection(false); /* ---> Everytime the cursor is moved, show the current font state. */ // should this too me moved out of this func? @@ -3082,7 +3099,6 @@ bool BufferView::Pimpl::Dispatch(kb_acti case LFUN_PARENTINSERT: { - lyxerr << "arg " << argument << endl; InsetCommandParams p("lyxparent", argument); Inset * inset = new InsetParent(p, *buffer_); if (!insertInset(inset, "Standard")) @@ -3157,6 +3173,7 @@ bool BufferView::Pimpl::Dispatch(kb_acti | BufferView::FITCUR | BufferView::CHANGE); } + workarea_.haveSelection(false); } beforeChange(lt); Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.635 diff -u -p -r1.635 ChangeLog --- src/ChangeLog 19 Mar 2002 15:27:34 -0000 1.635 +++ src/ChangeLog 19 Mar 2002 16:41:14 -0000 @@ -1,3 +1,13 @@ +2002-03-19 Juergen Vigna <[EMAIL PROTECTED]> + + * text2.C (clearSelection): reset also xsel_cache. + + * BufferView_pimpl.C (Dispatch): call WorkArea::haveSelection(false) + where it needs to be called (John tells us to do so too :) + (selectionLost): reset sel_cache. + + * WorkArea.C (event_cb): leave ret to 0 (John tells us to do so :) + 2002-03-19 André Pönitz <[EMAIL PROTECTED]> * lyxfunc.C: tiny whitespace change Index: src/WorkArea.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/WorkArea.C,v retrieving revision 1.64 diff -u -p -r1.64 WorkArea.C --- src/WorkArea.C 18 Mar 2002 22:38:25 -0000 1.64 +++ src/WorkArea.C 19 Mar 2002 16:41:15 -0000 @@ -574,12 +574,12 @@ int WorkArea::event_cb(XEvent * xev) case SelectionRequest: lyxerr[Debug::GUI] << "X requested selection." << endl; selectionRequested.emit(); - ret = 1; +// ret = 1; break; case SelectionClear: lyxerr[Debug::GUI] << "Lost selection." << endl; selectionLost.emit(); - ret = 1; +// ret = 1; break; } return ret; Index: src/lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.106 diff -u -p -r1.106 lyxtext.h --- src/lyxtext.h 3 Mar 2002 20:25:02 -0000 1.106 +++ src/lyxtext.h 19 Mar 2002 16:41:18 -0000 @@ -273,6 +273,8 @@ public: }; mutable Selection selection; + // this is used to handle XSelection events in the right manner + mutable Selection xsel_cache; /// needed for the toggling (cursor position on last selection made) mutable LyXCursor last_sel_cursor; Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.212 diff -u -p -r1.212 text2.C --- src/text2.C 18 Mar 2002 13:47:37 -0000 1.212 +++ src/text2.C 19 Mar 2002 16:41:19 -0000 @@ -1024,6 +1024,9 @@ void LyXText::clearSelection() const selection.set(false); selection.mark(false); last_sel_cursor = selection.end = selection.start = selection.cursor = cursor; + // reset this in the bv_owner! + if (bv_owner && bv_owner->text) + bv_owner->text->xsel_cache.set(false); } Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.353 diff -u -p -r1.353 ChangeLog --- src/insets/ChangeLog 19 Mar 2002 09:47:34 -0000 1.353 +++ src/insets/ChangeLog 19 Mar 2002 16:41:25 -0000 @@ -1,3 +1,7 @@ +2002-03-19 Juergen Vigna <[EMAIL PROTECTED]> + + * insetgraphics.C (draw): fixed the setting of CHANGED_IN_DRAW! + 2002-03-18 Angus Leeming <[EMAIL PROTECTED]> * insetgraphics.C: Clean up Baruch's comments a little. Index: src/insets/insetgraphics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.90 diff -u -p -r1.90 insetgraphics.C --- src/insets/insetgraphics.C 19 Mar 2002 09:47:34 -0000 1.90 +++ src/insets/insetgraphics.C 19 Mar 2002 16:41:28 -0000 @@ -341,7 +341,7 @@ void InsetGraphics::draw(BufferView * bv // the status message may mean we changed size, so indicate // we need a row redraw - if (old_status_ != cached_status_) { + if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) { bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW); }