From: Enrico Forestieri Date: Sat, 18 May 2019 14:06:33 +0000 (+0200) Subject: Fix bug #10498 X-Git-Tag: lyx-2.4.0dev-acb2ca7b~2019 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=61efbff545c7b529efc7138a87c6885ecfeb139b;p=features.git Fix bug #10498 Use the selection as the argument of a macro also when the macro has only optional arguments. --- diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 56a9dd8722..39d9654261 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1762,7 +1762,8 @@ bool Cursor::macroModeClose(bool cancel) // we have to resolve the macro here manually and check its arity // to put the selection behind it if arity > 0. MacroData const * data = buffer()->getMacro(atomAsMacro->name()); - if (!selection.empty() && data && data->numargs() - data->optionals() > 0) { + if (!selection.empty() && data && data->numargs() + && data->numargs() - data->optionals() >= 0) { macroArg = true; atomAsMacro->setDisplayMode(InsetMathMacro::DISPLAY_INTERACTIVE_INIT, 1); } else