From: Juergen Spitzmueller Date: Tue, 6 May 2014 14:12:45 +0000 (+0200) Subject: Stabilize mouse selection in mathed X-Git-Tag: 2.1.1~61 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5160fa104385f95c1d9b84db2cfed3ad59068e27;p=features.git Stabilize mouse selection in mathed Fixes: #9074 --- diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 479a68257c..83e49c43b8 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1567,16 +1567,29 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd) void InsetMathNest::lfunMouseMotion(Cursor & cur, FuncRequest & cmd) { // only select with button 1 - if (cmd.button() == mouse_button::button1) { - Cursor & bvcur = cur.bv().cursor(); - if (bvcur.realAnchor().hasPart(cur)) { - //lyxerr << "## lfunMouseMotion: cursor: " << cur << endl; - bvcur.setCursor(cur); - bvcur.setSelection(true); - //lyxerr << "MOTION " << bvcur << endl; - } else - cur.undispatched(); + if (cmd.button() != mouse_button::button1) + return; + + Cursor & bvcur = cur.bv().cursor(); + + // ignore motions deeper nested than the real anchor + if (!bvcur.realAnchor().hasPart(cur)) { + cur.undispatched(); + return; } + + CursorSlice old = bvcur.top(); + + // We continue with our existing selection or start a new one, so don't + // reset the anchor. + bvcur.setCursor(cur); + // Did we actually move? + if (cur.top() == old) + // We didn't move one iota, so no need to change selection status + // or update the screen. + cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor); + else + bvcur.setSelection(); } diff --git a/status.21x b/status.21x index 87cac02523..a2eb485d2c 100644 --- a/status.21x +++ b/status.21x @@ -101,6 +101,8 @@ What's new - Fix select-by-doubleclick in mathed (bug 8829). +- Make selection by mouse drag more reliable in mathed (bug 9074). + - Fix undo with many individual changes (e.g. with replace all) (bug #7079).