X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursor.cpp;h=92c9bdda2639161664d5b3d31efa6b85e851e1c1;hb=12ca81f2ea44c947fcd5f6d4f4c57bd5ebdf98d9;hp=997f5d5535217dba5dc9a03e273e5ed6e1b8dfe1;hpb=8f7b40955cc34e31a2932906d334499ef1af3665;p=lyx.git diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 997f5d5535..92c9bdda26 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -21,7 +21,6 @@ #include "Cursor.h" #include "CutAndPaste.h" #include "DispatchResult.h" -#include "Encoding.h" #include "Font.h" #include "FuncCode.h" #include "FuncRequest.h" @@ -454,19 +453,6 @@ int Cursor::currentMode() } -bool Cursor::inCoordCache() const -{ - // the root inset is not in cache, but we do not need it. - if (depth() == 1) - return true; - CoordCache::Insets const & icache = bv_->coordCache().getInsets(); - for (size_t i = 1 ; i < depth() ; ++i) - if (!icache.has(&(*this)[i].inset())) - return false; - return true; -} - - void Cursor::getPos(int & x, int & y) const { Point p = bv().getPos(*this); @@ -1414,7 +1400,7 @@ bool Cursor::down() } -bool Cursor::macroModeClose() +bool Cursor::macroModeClose(bool cancel) { if (!inMacroMode()) return false; @@ -1426,14 +1412,15 @@ bool Cursor::macroModeClose() --pos(); cell().erase(pos()); - // do nothing if the macro name is empty - if (s == "\\") - return false; - // trigger updates of macros, at least, if no full // updates take place anyway screenUpdateFlags(Update::Force); + // do nothing if the macro name is empty + if (s == "\\" || cancel) { + return false; + } + docstring const name = s.substr(1); InsetMathNest * const in = inset().asInsetMath()->asNestInset(); if (in && in->interpretString(*this, s)) @@ -2138,22 +2125,6 @@ docstring Cursor::getPossibleLabel() const } -Encoding const * Cursor::getEncoding() const -{ - if (empty()) - return 0; - BufferParams const & bp = bv().buffer().params(); - if (bp.useNonTeXFonts) - return encodings.fromLyXName("utf8-plain"); - - CursorSlice const & sl = innerTextSlice(); - Text const & text = *sl.text(); - Font font = text.getPar(sl.pit()).getFont(bp, sl.pos(), - text.outerFont(sl.pit())); - return font.language()->encoding(); -} - - void Cursor::undispatched() const { disp_.dispatched(false);