+
+
+void InsetCollapsable::close(BufferView * bv) const
+{
+ if (collapsed_)
+ return;
+
+ collapsed_ = true;
+ bv->updateInset(const_cast<InsetCollapsable *>(this), false);
+}
+
+
+void InsetCollapsable::setLabel(string const & l) const
+{
+ label = l;
+}
+
+
+bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ bool found = inset.searchForward(bv, str, cs, mw);
+ if (first_after_edit && !found)
+ close(bv);
+ first_after_edit = false;
+ return found;
+}
+
+
+bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ bool found = inset.searchBackward(bv, str, cs, mw);
+ if (first_after_edit && !found)
+ close(bv);
+ first_after_edit = false;
+ return found;
+}
+
+
+string const InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv,
+ float & value) const
+{
+ string const str = inset.selectNextWordToSpellcheck(bv, value);
+ if (first_after_edit && str.empty())
+ close(bv);
+ first_after_edit = false;
+ return str;
+}