#include "frontends/Selection.h"
#include "insets/InsetArgument.h"
-#include "insets/InsetCollapsable.h"
+#include "insets/InsetCollapsible.h"
#include "insets/InsetCommand.h"
#include "insets/InsetExternal.h"
#include "insets/InsetFloat.h"
#include "support/regex.h"
#include "mathed/InsetMathHull.h"
-#include "mathed/MathMacroTemplate.h"
+#include "mathed/InsetMathMacroTemplate.h"
#include <clocale>
#include <sstream>
if (!inset)
return false;
- if (InsetCollapsable * ci = inset->asInsetCollapsable())
+ if (InsetCollapsible * ci = inset->asInsetCollapsible())
ci->setButtonLabel();
cur.recordUndo();
DocumentClass const & tc = buf.params().documentClass();
DocumentClass::const_iterator lit = tc.begin();
DocumentClass::const_iterator len = tc.end();
- int const newtoclevel =
+ int const newtoclevel =
(mode == OutlineIn ? toclevel + 1 : toclevel - 1);
LabelType const oldlabeltype = start->layout().labeltype;
return par.isRTL(buffer.params());
}
-
+
namespace {
-
+
Language const * getLanguage(Cursor const & cur, string const & lang) {
return lang.empty() ? cur.getFont().language() : languages.getLanguage(lang);
}
-}
+} // namespace
void Text::dispatch(Cursor & cur, FuncRequest & cmd)
cur.noScreenUpdate();
LBUFERR(this == cur.text());
-
+
// NOTE: This should NOT be a reference. See commit 94a5481a.
CursorSlice const oldTopSlice = cur.top();
bool const oldBoundary = cur.boundary();
cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
} else {
+ pos_type newpos = up ? 0 : cur.lastpos();
+ if (lyxrc.mac_like_cursor_movement && cur.pos() != newpos) {
+ needsUpdate |= cur.selHandle(select);
+ // we do not reset the targetx of the cursor
+ cur.pos() = newpos;
+ needsUpdate |= bv->checkDepm(cur, bv->cursor());
+ cur.updateTextTargetOffset();
+ if (needsUpdate)
+ cur.forceBufferUpdate();
+ break;
+ }
+
// if the cursor cannot be moved up or down do not remove
// the selection right now, but wait for the next dispatch.
if (select)
break;
}
cur.pos() = cur.lastpos();
+ cur.boundary(false);
+ cur.setCurrentFont();
needsUpdate |= cur != old_cur;
break;
}
ins->setParams(inspar);
+ break;
}
case LFUN_SPACE_INSERT:
string const name = to_utf8(cmd.argument());
if (name == "hyphenation")
specialChar(cur, InsetSpecialChar::HYPHENATION);
+ else if (name == "allowbreak")
+ specialChar(cur, InsetSpecialChar::ALLOWBREAK);
else if (name == "ligature-break")
specialChar(cur, InsetSpecialChar::LIGATURE_BREAK);
else if (name == "slash")
int const wh = bv->workHeight();
int const y = max(0, min(wh - 1, cmd.y()));
- tm->setCursorFromCoordinates(cur, cmd.x(), y, true);
+ tm->setCursorFromCoordinates(cur, cmd.x(), y);
cur.setTargetX(cmd.x());
// Don't allow selecting a separator inset
if (cur.pos() && cur.paragraph().isEnvSeparator(cur.pos() - 1))
// reset the anchor.
bvcur.setCursor(cur);
bvcur.selection(true);
+ bvcur.setCurrentFont();
if (cur.top() == old) {
// We didn't move one iota, so no need to update the screen.
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
// don't pass "on" as argument
// (it would appear literally in the first cell)
docstring sel = cur.selectionAsString(false);
- MathMacroTemplate * macro = new MathMacroTemplate(cur.buffer());
+ InsetMathMacroTemplate * macro = new InsetMathMacroTemplate(cur.buffer());
// create a macro template if we see "\\newcommand" somewhere, and
// an ordinary formula otherwise
if (!sel.empty()
MacroType type = MacroTypeNewcommand;
if (s2 == "def")
type = MacroTypeDef;
- MathMacroTemplate * inset = new MathMacroTemplate(cur.buffer(),
+ InsetMathMacroTemplate * inset = new InsetMathMacroTemplate(cur.buffer(),
from_utf8(token(s, ' ', 0)), nargs, false, type);
inset->setBuffer(bv->buffer());
insertInset(cur, inset);
for (; pit <= lastpit; ++pit) {
if (pars_[pit].layout() != lay)
break;
- InsetList::const_iterator it = pars_[pit].insetList().begin();
- InsetList::const_iterator end = pars_[pit].insetList().end();
- for (; it != end; ++it) {
- if (it->inset->lyxCode() == ARG_CODE) {
- InsetArgument const * ins =
- static_cast<InsetArgument const *>(it->inset);
+ for (auto const & table : pars_[pit].insetList())
+ if (InsetArgument const * ins = table.inset->asInsetArgument())
if (ins->name() == arg) {
// we have this already
enable = false;
break;
}
- }
- }
}
} else
enable = false;