-
- breakParagraphConservative(current_view->buffer()->params,
- startpar,
- start);
-
- // store the selection
- if (realcut) {
- buf = startpar->next();
- buf->previous(0);
- } else {
- startpar->next()->previous(0);
+ }
+
+ // Loop through the deleted pars if any, erasing as needed
+
+ Paragraph * pit = startpar->next();
+
+ while (1) {
+ // *endpar can be 0
+ if (!pit)
+ break;
+
+ Paragraph * next = pit->next();
+
+ // "erase" the contents of the par
+ if (pit != *endpar) {
+ actually_erased |= pit->erase(0, pit->size());
+
+ // remove the par if it's now empty
+ if (actually_erased) {
+ pit->previous()->next(pit->next());
+ if (next) {
+ next->previous(pit->previous());
+ }
+ lyxerr << "deleting pit " << pit << endl;
+
+ delete pit;
+ }