]> git.lyx.org Git - lyx.git/blobdiff - src/CursorSlice.cpp
avoid redundant toolbar initialization
[lyx.git] / src / CursorSlice.cpp
index 42d365361ce5abacbce794ab42223eea70f9bf0d..b4352e3ba4b64976d54448fb9d62bfc33b8dd184 100644 (file)
@@ -3,10 +3,10 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Matthias Ettrich
- * \author André Pönitz
- * \author Jürgen Vigna
+ * \author André Pönitz
+ * \author Jürgen Vigna
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -23,9 +23,9 @@
 #include "insets/Inset.h"
 
 #include "mathed/InsetMath.h"
-#include "mathed/MathData.h"
+#include "mathed/MathMacro.h"
 
-#include "support/assert.h"
+#include "support/lassert.h"
 
 #include <ostream>
 
@@ -61,8 +61,10 @@ Paragraph & CursorSlice::paragraph() const
 pos_type CursorSlice::lastpos() const
 {
        LASSERT(inset_, /**/);
-       return inset_->asInsetMath() ? cell().size() 
-               : (text()->empty() ? 0 : paragraph().size());
+       InsetMath const * math = inset_->asInsetMath();
+       bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs();
+       return math ? (paramless_macro ? 0 : cell().size()) 
+                   : (text()->empty() ? 0 : paragraph().size());
 }