#include "Bidi.h"
#include "Buffer.h"
+#include "BufferParams.h"
#include "BufferView.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "OutputParams.h"
#include "Text.h"
+#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
size_t n = 0;
idocstringstream is(cmd.argument());
is >> n;
- topaste = cap::selection(n);
+ topaste = cap::selection(n, buffer().params().documentClassPtr());
}
cur.niceInsert(topaste, parseflg, false);
cur.clearSelection(); // bug 393
case LFUN_MOUSE_DOUBLE:
case LFUN_MOUSE_TRIPLE:
case LFUN_WORD_SELECT:
- case LFUN_INSET_SELECT_ALL:
cur.pos() = 0;
cur.idx() = 0;
cur.resetAnchor();
case LFUN_REGEXP_MODE: {
InsetMath * im = cur.inset().asInsetMath();
if (im) {
- InsetMathHull * i = im->asHullInset();
+ InsetMathHull * i = im->asHullInset();
if (i && i->getType() == hullRegexp) {
cur.message(_("Already in regular expression mode"));
break;
&& name != "Bmatrix" && name != "vmatrix"
&& name != "Vmatrix" && name != "matrix")
name = from_ascii("matrix");
-
+
cur.niceInsert(
MathAtom(new InsetMathAMSArray(buffer_, name, m, n)));
break;
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
cur.recordUndoSelection();
cur.insert(ar);
- cur.forceBufferUpdate();
+ cur.forceBufferUpdate();
} else
cur.undispatched();
break;
case LFUN_CAPTION_INSERT:
flag.setEnabled(false);
break;
-
+
case LFUN_SPACE_INSERT: {
docstring const & name = cmd.argument();
if (name == "visible")
// cur.result().update(): don't overwrite previously set flags.
cur.screenUpdateFlags(Update::Decoration | Update::FitCursor
| cur.result().screenUpdate());
- } else if (cmd.button() == mouse_button::button2) {
+ } else if (cmd.button() == mouse_button::button2 && lyxrc.mouse_middlebutton_paste) {
if (cap::selection()) {
// See comment in Text::dispatch why we do this
cap::copySelectionToStack();
}
// do not finish macro for known * commands
- MathWordList const & mwl = mathedWordList();
bool star_macro = c == '*'
- && (mwl.find(name.substr(1) + "*") != mwl.end()
+ && (in_word_set(name.substr(1) + '*')
|| cur.buffer()->getMacro(name.substr(1) + "*", cur, true));
if (isAlphaASCII(c) || star_macro) {
cur.activeMacro()->setName(name + docstring(1, c));
cur.autocorrect() = false;
cur.message(_("Autocorrect Off ('!' to enter)"));
return true;
- }
+ }
if (lyxrc.autocorrection_math && c == '!' && !cur.autocorrect()) {
cur.autocorrect() = true;
cur.message(_("Autocorrect On (<space> to exit)"));
// fill in global macros
macros.clear();
- MacroTable::globalMacros().getMacroNames(macros);
+ MacroTable::globalMacros().getMacroNames(macros, false);
//lyxerr << "Globals completion macros: ";
for (it = macros.begin(); it != macros.end(); ++it) {
//lyxerr << "\\" + *it << " ";
MathWordList::const_iterator it2;
//lyxerr << "Globals completion commands: ";
for (it2 = words.begin(); it2 != words.end(); ++it2) {
- globals.push_back("\\" + (*it2).first);
- //lyxerr << "\\" + (*it2).first << " ";
+ if (it2->second.inset != "macro" && !it2->second.hidden) {
+ // macros are already read from MacroTable::globalMacros()
+ globals.push_back('\\' + it2->first);
+ //lyxerr << '\\' + it2->first << ' ';
+ }
}
//lyxerr << std::endl;
sort(globals.begin(), globals.end());
cmd = locals[idx];
// get the icon resource name by stripping the backslash
- return "images/math/" + to_utf8(cmd.substr(1)) + ".png";
+ docstring icon_name = frontend::Application::mathIcon(cmd.substr(1));
+ if (icon_name.empty())
+ return std::string();
+ return "images/math/" + to_utf8(icon_name);
}
std::vector<docstring> MathCompletionList::globals;