+ }
+#endif
+ }
+}
+
+
+void InsetText::resizeLyXText(BufferView * bv) const
+{
+#ifndef NEW_INSETS
+ if (!par->next_ && !par->size()) // resize not neccessary!
+#else
+ if (!par->next() && !par->size()) // resize not neccessary!
+#endif
+ return;
+ if ((cache.find(bv) == cache.end()) || !cache[bv])
+ return;
+
+ LyXParagraph * lpar = 0;
+ LyXParagraph * selstartpar = 0;
+ LyXParagraph * selendpar = 0;
+ LyXParagraph::size_type pos = 0;
+ LyXParagraph::size_type selstartpos = 0;
+ LyXParagraph::size_type selendpos = 0;
+ bool boundary = false;
+ bool selstartboundary = false;
+ bool selendboundary = false;
+ int selection = 0;
+ int mark_set = 0;
+
+// ProhibitInput(bv);
+
+ if (locked) {
+ lpar = TEXT(bv)->cursor.par();
+ pos = TEXT(bv)->cursor.pos();
+ boundary = TEXT(bv)->cursor.boundary();
+ selstartpar = TEXT(bv)->sel_start_cursor.par();
+ selstartpos = TEXT(bv)->sel_start_cursor.pos();
+ selstartboundary = TEXT(bv)->sel_start_cursor.boundary();
+ selendpar = TEXT(bv)->sel_end_cursor.par();
+ selendpos = TEXT(bv)->sel_end_cursor.pos();
+ selendboundary = TEXT(bv)->sel_end_cursor.boundary();
+ selection = TEXT(bv)->selection;
+ mark_set = TEXT(bv)->mark_set;
+ }
+ deleteLyXText(bv, (the_locking_inset == 0));
+
+ if (lpar) {
+ TEXT(bv)->selection = true;
+ /* at this point just to avoid the Delete-Empty-Paragraph
+ * Mechanism when setting the cursor */
+ TEXT(bv)->mark_set = mark_set;
+ if (selection) {
+ TEXT(bv)->SetCursor(bv, selstartpar, selstartpos,true,
+ selstartboundary);
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
+ TEXT(bv)->SetCursor(bv, selendpar, selendpos, true, selendboundary);
+ TEXT(bv)->SetSelection(bv);
+ TEXT(bv)->SetCursor(bv, lpar, pos);
+ } else {
+ TEXT(bv)->SetCursor(bv, lpar, pos, true, boundary);
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
+ TEXT(bv)->selection = false;
+ }
+ }
+ if (bv->screen())
+ TEXT(bv)->first = bv->screen()->TopCursorVisible(TEXT(bv));
+ // this will scroll the screen such that the cursor becomes visible
+ bv->updateScrollbar();
+// AllowInput(bv);
+ if (the_locking_inset) {
+ /// then resize all LyXText in text-insets
+ inset_x = cx(bv) - top_x + drawTextXOffset;
+ inset_y = cy(bv) + drawTextYOffset;
+#ifndef NEW_INSETS
+ for (LyXParagraph * p = par; p; p = p->next_) {
+ p->resizeInsetsLyXText(bv);
+ }
+#else
+ for (LyXParagraph * p = par; p; p = p->next()) {
+ p->resizeInsetsLyXText(bv);
+ }
+#endif
+ }
+ need_update = FULL;
+}
+
+
+void InsetText::removeNewlines()
+{
+#ifndef NEW_INSETS
+ for (LyXParagraph * p = par; p; p = p->next_) {
+#else
+ for (LyXParagraph * p = par; p; p = p->next()) {
+#endif
+ for (int i = 0; i < p->Last(); ++i) {
+ if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
+ p->Erase(i);
+ }