From c9fc5bf1c69fb2a24e928a79be25e7415819aab1 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Sun, 4 Sep 2016 23:24:57 +0100 Subject: [PATCH] Fix: shift-mouse selection doesn't work well across insets (FIXME in the code, no corresponding ticket found even though it is pretty annoying) --- src/BufferView.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index dc4f8a1e3b..ce8306105a 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2517,7 +2517,7 @@ bool BufferView::checkDepm(Cursor & cur, Cursor & old) } -bool BufferView::mouseSetCursor(Cursor & cur, bool select) +bool BufferView::mouseSetCursor(Cursor & cur, bool const select) { LASSERT(&cur.bv() == this, return false); @@ -2535,27 +2535,23 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select) if (leftinset) d->cursor_.fixIfBroken(); - // FIXME: shift-mouse selection doesn't work well across insets. - bool const do_selection = - select && &d->cursor_.normalAnchor().inset() == &cur.inset(); - // do the dEPM magic if needed // FIXME: (1) move this to InsetText::notifyCursorLeaves? // FIXME: (2) if we had a working InsetText::notifyCursorLeaves, // the leftinset bool would not be necessary (badcursor instead). bool update = leftinset; - if (!do_selection && d->cursor_.inTexted()) - update |= checkDepm(cur, d->cursor_); - if (!do_selection) - d->cursor_.resetAnchor(); - d->cursor_.setCursor(cur); - d->cursor_.boundary(cur.boundary()); - if (do_selection) + if (select) { d->cursor_.setSelection(); - else + d->cursor_.setCursorSelectionTo(cur); + } else { + if (d->cursor_.inTexted()) + update |= checkDepm(cur, d->cursor_); + d->cursor_.resetAnchor(); + d->cursor_.setCursor(cur); d->cursor_.clearSelection(); - + } + d->cursor_.boundary(cur.boundary()); d->cursor_.finishUndo(); d->cursor_.setCurrentFont(); if (update) -- 2.39.2