]> git.lyx.org Git - features.git/commitdiff
If there is an inset at cursor, connect the dialog with that, not the containing one
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 26 May 2015 17:33:07 +0000 (19:33 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 26 May 2015 17:33:07 +0000 (19:33 +0200)
Fixes: #8716 ("minipage within minipage" Settings bug)
This is a potential candidate for branch, but only after some more testing.

src/frontends/qt4/Dialog.cpp

index 17db59300103a4b060de55a71811e180bd69bd3a..a9c1250b6eb5276660816435c370d06f2b8eae11 100644 (file)
@@ -219,11 +219,23 @@ bool Dialog::isVisibleView() const
 
 Inset const * Dialog::inset(InsetCode code) const
 {
+       // ins: the innermost inset of the type we look for
+       //      that contains the cursor
        Inset * ins = bufferview()->cursor().innerInsetOfType(code);
-       if (!ins)
-               ins = bufferview()->cursor().nextInset();
-       if (!ins || ins->lyxCode() != code)
-               return 0;
+       // next: a potential inset at cursor position
+       Inset * next = bufferview()->cursor().nextInset();
+       // Check if next is of the type we look for
+       if (next)
+               if (next->lyxCode() != code)
+                       next = 0;
+       if (ins) {
+               // prefer next if it is of the requested type (bug 8716)
+               if (next)
+                       ins = next;
+       } else
+               // no containing inset of requested type
+               // use next (which might also be 0)
+               ins = next;
        return ins;
 }