]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.cpp
Move the contents of a row into the caption when setting a row as a longtable caption.
[lyx.git] / src / insets / InsetTabular.cpp
index 2affeaaf51444955f615301d9e10081d95591b1c..9b0abc9690dd2f0ca0941f64170925bdfcdb47e2 100644 (file)
@@ -4761,6 +4761,14 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                break;
 
        case Tabular::UNSET_LONGTABULAR:
+               for (row_type i = 0; i < tabular.row_info.size(); ++i) {
+                       if (tabular.ltCaption(i)) {
+                               cur.idx() = tabular.cellIndex(i, 0);
+                               cur.pit() = 0;
+                               cur.pos() = 0;
+                               tabularFeatures(cur, Tabular::TOGGLE_LTCAPTION);
+                       }
+               }
                tabular.is_long_tabular = false;
                break;
 
@@ -4880,11 +4888,12 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                cur.pos() = 0;
                cur.setSelection(false);
 
-               if (set)
+               if (set) {
                        // When a row is set as caption, then also insert
                        // a caption. Otherwise the LaTeX output is broken.
+                       lyx::dispatch(FuncRequest(LFUN_INSET_SELECT_ALL));
                        lyx::dispatch(FuncRequest(LFUN_CAPTION_INSERT));
-               else {
+               else {
                        FuncRequest fr(LFUN_INSET_DISSOLVE, "caption");
                        if (lyx::getStatus(fr).enabled())
                                lyx::dispatch(fr);