commit c9fc5bf1c69fb2a24e928a79be25e7415819aab1
Author: Guillaume Munch <[email protected]>
Date: Sun Sep 4 23:24:57 2016 +0100
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 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index dc4f8a1..ce83061 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)