commit 9f777d4bfb711f3fa6daa8d61eb071d365b5d076
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat Jul 25 12:48:13 2015 +0200

    Do not attempt to select an empty cell before inserting a longtable caption
    
    Fixes: #9692

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 7ae5bc0..f2f65cc 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -5885,7 +5885,9 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                cur.setSelection(false);
                // If a row is set as caption, then also insert
                // a caption. Otherwise the LaTeX output is broken.
-               lyx::dispatch(FuncRequest(LFUN_INSET_SELECT_ALL));
+               // Select cell if it is non-empty
+               if (cur.lastpos() > 0 || cur.lastpit() > 0)
+                       lyx::dispatch(FuncRequest(LFUN_INSET_SELECT_ALL));
                lyx::dispatch(FuncRequest(LFUN_CAPTION_INSERT));
                break;
        }

Reply via email to