]> git.lyx.org Git - lyx.git/commitdiff
Use Color_selectionmath as needed for multi-cell selection in math
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Oct 2023 09:09:46 +0000 (11:09 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Oct 2023 09:30:47 +0000 (11:30 +0200)
This is complementary to partial selection implemented at 65cb9fa4.

src/mathed/MathData.cpp

index eee53d2f50cb42d969e350da2f2e33e589b2aaaa..24b4d86fb90649a006ddb2922924c8072919ec97 100644 (file)
@@ -239,6 +239,18 @@ bool MathData::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
                if (s1.idx() == s2.idx() && &inset->cell(s1.idx()) == this) {
                        bspos = s1.pos();
                        espos = s2.pos();
+               } else if (s1.idx() != s2.idx()) {
+                       // search for this math data and check whether it is selected
+                       for (idx_type idx = 0; idx < inset->nargs(); ++idx) {
+                               MathData const & c = inset->cell(idx);
+                               if (&c == this && inset->idxBetween(idx, s1.idx(), s2.idx())) {
+                                       // whole cell is selected
+                                       bspos = 0;
+                                       espos = size();
+                                       // no need to continue searchning
+                                       break;
+                               }
+                       }
                }
        }