commit aae52eb9fb1f462094545276df5767dca0024ba8
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Mon May 19 16:22:11 2025 +0200
Make sure to close auto-open collapsible insets when leaving them
In order to do that, all we need is to declare a notifyCursorLeaves()
method.
---
src/insets/InsetCollapsible.cpp | 11 +++++++++++
src/insets/InsetCollapsible.h | 3 +++
2 files changed, 14 insertions(+)
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index 42ee9e8394..fe8c7b2142 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -120,6 +120,17 @@ InsetCollapsible::Geometry
InsetCollapsible::geometry(BufferView const & bv) con
}
+bool InsetCollapsible::notifyCursorLeaves(Cursor const & old, Cursor & cur)
+{
+ if (view_[&old.bv()].auto_open_ && old.find(this) != lyx::npos
+ && cur.find(this) == lyx::npos)
+ // FIXME: when Update::SinglePar can specify a paragraph, use
that.
+ cur.screenUpdateFlags(Update::Force | Update::FitCursor);
+
+ return InsetText::notifyCursorLeaves(old, cur);
+}
+
+
docstring InsetCollapsible::toolTip(BufferView const & bv, int x, int y) const
{
Dimension const dim = dimensionCollapsed(bv);
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index 9e62a4df15..695e05472f 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -137,6 +137,9 @@ public:
/// (status_), auto_open_[BufferView] and openinlined_,
/// and of course decoration().
Geometry geometry(BufferView const & bv) const;
+ /// This closes insets that are auto_open_
+ bool notifyCursorLeaves(Cursor const & old, Cursor & cur) override;
+
///
bool canPaintChange(BufferView const & bv) const override;
///
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs